#include #define rep(i,a,b) for(int i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } //--------------------------------------------------------------------------------------------------- /*---------------------------------------------------------------------------------------------------             ∧_∧       ∧_∧  (´<_` )  Welcome to My Coding Space!      ( ´_ゝ`) /  ⌒i     /   \    | |     /   / ̄ ̄ ̄ ̄/  |   __(__ニつ/  _/ .| .|____      \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ //--------------------------------------------------------------------------------------------------- void _main() { string s = "ABC"; vector, char>> v; rep(i, 0, 3) { int a, b; cin >> a >> b; v.push_back({ {a, b}, s[i] }); } sort(v.begin(), v.end(), [&](pair, char> a, pair, char> b) { if (a.first.first != b.first.first) return a.first.first > b.first.first; return a.first.second < a.first.second; }); fore(p, v) printf("%c\n", p.second); }