#include "bits/stdc++.h" using namespace std; int yurufuwa(string X, string Y) { if (X.size() > Y.size()) return 1; if (X.size() < Y.size()) return -1; for (int i = 0; i < X.size(); i++) { if (X[i] > Y[i]) return 1; if (X[i] < Y[i]) return -1; } return 0; } int main() { string SA, PA, XA, SB, PB, XB; cin >> SA >> PA >> XA >> SB >> PB >> XB; if (yurufuwa(PA, PB) == 1) cout << SA << endl; else if (yurufuwa(PA, PB) == -1) cout << SB << endl; else cout << -1 << endl; }