import java.math.BigInteger; class Yuki { String name; BigInteger yurufuwa; String hand; Yuki(String s1,BigInteger b,String s2){ this.name = s1; this.yurufuwa = b; this.hand = s2; } String judge(Yuki y) { int i = this.yurufuwa.compareTo(y.yurufuwa); if (i == 0) { return "-1"; } else { return i > 0 ? this.name : y.name; } } } class No_201 { public static void main(String[] args) { java.util.Scanner sc = new java.util.Scanner(System.in); Yuki y1 = new Yuki(sc.next(),sc.nextBigInteger(),sc.next()); Yuki y2 = new Yuki(sc.next(),sc.nextBigInteger(),sc.next()); System.out.println(y1.judge(y2)); sc.close(); } }