#include #include #include using namespace std; bool cmp(int a, int b) { return (b < a); } int main(void) { vector pack; int npacks; int tmp; bool nexta = false; while(true){ cin >> npacks; if(npacks == 0) break; for(int i=0; i> tmp; pack.push_back(tmp); //cout << tmp << endl; } sort(pack.begin(), pack.end(), cmp); cout << pack.back() << "-A"; pack.pop_back(); nexta = false; for(vector::iterator it = pack.begin(); it != pack.end(); it++){ cout << " " << *it; if(nexta){ cout << "-A"; }else{ cout << "-B"; } nexta = !nexta; } cout << endl; pack.clear(); } return 0; }