#include #include int scmp(const std::string& s, const std::string& t) { if (s.length() != t.length()) { return s.length() > t.length() ? 1 : -1; } else { return s == t ? 0 : s > t ? 1 : -1; } } void solve() { std::string sa, pa, sb, pb; char tmp; std::cin >> sa >> pa >> tmp >> sb >> pb >> tmp; int pres = scmp(pa, pb); std::cout << (pres == 0 ? "-1" : pres > 0 ? sa : sb) << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }