package me.yukicoder.lv1_5; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No0201 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] inputA = br.readLine().split(" "); String[] inputB = br.readLine().split(" "); long a = Long.parseLong(inputA[1]); long b = Long.parseLong(inputB[1]); if (a > b) { System.out.println(inputA[0]); } else if (a < b) { System.out.println(inputB[0]); } else { System.out.println(-1); } } }