import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] argv) { Scanner scanner = new Scanner(System.in); String name1, name2; BigInteger p1, p2; name1 = scanner.next(); p1 = new BigInteger(scanner.next()); scanner.next(); name2 = scanner.next(); p2 = new BigInteger(scanner.next()); scanner.next(); int res = p1.compareTo(p2); if (res > 0) { System.out.println(name1); } else if (res < 0) { System.out.println(name2); } else { System.out.println(-1); } } }