#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; int calc(const string& a, const string& b){ if(a==b) return 0; if(a.size() < b.size()) return -1; if(a.size() > b.size()) return 1; rep(i,a.size()){ if(a[i]-'0' < b[i]-'0') return -1; if(a[i]-'0' > b[i]-'0') return 1; } return 0; } int main(){ string a,b,c,d,e,f; cin >> a >> b >> c; cin >> d >> e >> f; int res = calc(b,e); if(res == 1){ cout << a << endl; } if(res == 0){ cout << -1 << endl; } if(res == -1){ cout << d << endl; } return 0; }