import java.math.BigInteger; import java.util.Scanner; public class No201 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // 一人目を入力 String name1 = sc.next(); BigInteger p1 = new BigInteger(sc.next()); String x1 = sc.next(); // 二人目を入力 String name2 = sc.next(); BigInteger p2 = new BigInteger(sc.next()); String x2 = sc.next(); // 判定 if(p1.compareTo(p2) == 1){ System.out.println(name1); }else if(p1.compareTo(p2) == -1){ System.out.println(name2); }else{ System.out.println("-1"); } } }