#define _USE_MATH_DEFINES #include //cin, cout #include //vector #include //sort,min,max,count #include //string,getline, to_string #include //abs(int) #include //swap, pair #include //deque #include //INT_MAX #include //bitset #include //sqrt, ceil. M_PI, pow, sin #include //fixed #include //setprecision #include //stringstream #include //gcd, assumlate #include //randam_device #include //numeric_limits using namespace std; constexpr long long int D_MOD = 1000000007; int main() { string SA, PA, XA; string SB, PB, XB; cin >> SA >> PA >> XA >> SB >> PB >> XB; if (PA == PB) { cout << -1 << endl; return 0; } if (PA.length() > PB.length()) { cout << SA << endl; } else if (PA.length() < PB.length()) { cout << SB << endl; } else { for (unsigned int i = 0; i < PA.length(); i++) { if (PA[i] > PB[i]) { cout << SA << endl; return 0; } if (PA[i] < PB[i]) { cout << SB << endl; return 0; } } } return 0; }