#include #include #include using namespace std; int main(){ string sa, pa, xa, sb, pb, xb; cin>> sa>> pa>> xa; cin>> sb>> pb>> xb; map mp; mp[sa] = pa; mp[sb] = pb; if(mp[sa]==mp[sb]){ cout<< -1<< endl; return 0; } if(mp[sa] < mp[sb]){ cout<< sb<< endl; }else{ cout<< sa<< endl; } return 0; }