#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { string SA, PA, XA; string SB, PB, XB; cin >> SA >> PA >> XA; cin >> SB >> PB >> XB; string res = "-1"; if (PA.size() > PB.size()) { res = SA; } else if (PA.size() < PB.size()) { res = SB; } else { for (int i = 0; i < PA.size(); ++i) { int a = PA[i] - '0'; int b = PB[i] - '0'; if (a > b) { res = SA; } else if (a < b) { res = SB; } } } cout << res << endl; return 0; }