import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s1 = sc.next(), p1 = sc.next(), x = sc.next(); String s2 = sc.next(), p2 = sc.next(), y = sc.next(); if(p1.length() > p2.length()){ System.out.println(s1); } else if(p1.length() < p2.length()){ System.out.println(s2); }else if(p1.compareTo(p2) > 0){ System.out.println(s1); } else if(p1.compareTo(p2) < 0){ System.out.println(s2); } else { System.out.println(-1); } } }