#include #define REP(i,a,b) for(int i=(a);i<(b);i++) #define RREP(i,a,b) for(int i=(a);i>=(b);i--) typedef long long ll; typedef long double ld; using namespace std; const int INF=1e9, MOD=1e9+7, mod=998244353; int a,b; vector>> vec; int main(){ cin >> a >> b; vec.push_back(make_pair(a,make_pair(100-b,'A'))); cin >> a >> b; vec.push_back(make_pair(a,make_pair(100-b,'B'))); cin >> a >> b; vec.push_back(make_pair(a,make_pair(100-b,'C'))); sort(vec.rbegin(),vec.rend()); REP(i,0,3) cout << (vec[i].second).second << endl; return 0; }