#include using namespace std; // #define int long long #define pb push_back #define print(Target) cout << Target << '\n' #define REP(i, n) for (int i = 0; i < (n); i++) #define REPS(i, a, n) for (int i = (a); i < (n); i++) typedef long long ll; typedef unsigned long long ull; typedef vector vi; typedef vector > vii; typedef pair pii; bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));} signed main() { ios::sync_with_stdio(false); string s[2], p[2], x[2]; REP(i, 2) cin >> s[i] >> p[i] >> x[i]; bool flg = true; if (p[0].size() != p[1].size()){ print(s[p[0].size() < p[1].size()]); flg = false; }else { REP(i, p[0].size()){ if (p[0][i] != p[1][i]){ print(s[p[0][i] < p[1][i]]); flg = false; break; } } } if (flg){ print("-1"); } return (0); }