#include using namespace std; int main() { string Sa, Pa, Xa, Sb, Pb, Xb; cin >> Sa >> Pa >> Xa >> Sb >> Pb >> Xb; string ans; if( Pa.size() > Pb.size() ) ans = Sa; else if( Pa.size() < Pb.size() ) ans = Sb; else { for( int i = 0; i < Pa.size(); i++ ) { if( Pa[i] > Pb[i] ) { ans = Sa; break; } else if( Pa[i] < Pb[i] ) { ans = Sb; break; } } } if( ans.size() == 0 ) ans = "-1"; cout << ans << endl; }