#include using namespace std; int main(){ string str = "ABC"; vector , char>> v; int in1, in2, i = 0; while(cin >> in1 >>in2){ v.push_back({{in1, in2}, str[i++]}); } sort(v.begin(), v.end(), [&](pair , char> x, pair , char> y){ if(x.first.first != y.first.first){ return x.first.first > y.first.first; }else{ return x.first.second < y.first.second; } }); for(i = 0; i < v.size(); i++){ cout << v[i].second << endl; } return 0; }