//Normal #define _GLIBCXX_DEBUG #define ll long long #include using namespace std; using Graph = vector>; void print(auto a){ cout << a; } void prints(auto a){ cout << a << " "; } void prints(){ cout << " "; } void printl(auto a){ cout << a << endl; } void printl(){ cout << endl; } void fix(int n){ cout << fixed << setprecision(n); } int main(){ string SA, PA, XA, SB, PB, XB; cin >> SA >> PA >> XA >> SB >> PB >> XB; if(PA == PB){ printl(-1); }else{ int jud; int pa = (int)PA.size(); int pb = (int)PB.size(); if(pa == pb){ for(int i = 0; i < pa; i++){ if(PA[i] == PB[i]) continue; PA[i] > PB[i] ? jud = 1 : jud = -1; break; } }else{ pa > pb ? jud = 1 : jud = -1; } jud == 1 ? printl(SA) : printl(SB); } return 0; }