import java.util.Scanner; public class Main_yukicoder201 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] s = new String[2]; String[] p = new String[2]; String[] x = new String[2]; for (int i = 0; i < 2; i++) { s[i] = sc.next(); p[i] = sc.next(); x[i] = sc.next(); } int res = p[0].compareTo(p[1]); if (p[0].length() > p[1].length()) { System.out.println(s[0]); } else if (p[0].length() < p[1].length()) { System.out.println(s[1]); } else { if (res > 0) { System.out.println(s[0]); } else if (res < 0) { System.out.println(s[1]); } else { System.out.println("-1"); } } sc.close(); } }