#include using namespace std; int s1, s2; string p1, p2, s; void input() { cin >> p1 >> s1 >> s >> p2 >> s2 >> s; } void solve() { cout << ((s1 == s2) ? ("-1") : ((s1 > s2) ? (p1) : (p2))) << endl; } int main() { ios::sync_with_stdio(false); cin.tie(0); input(); solve(); }