package yukicoder; import java.io.BufferedReader; import java.io.InputStreamReader; import java.math.BigInteger; public class Main { public static void main(String[] args) { BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); try { String[] firBox = read.readLine().split(" "); String[] secBox = read.readLine().split(" "); BigInteger first = new BigInteger(firBox[1]); BigInteger second = new BigInteger(secBox[1]); if (first.equals(second)) { System.out.println(-1); } else if (first.max(second).equals(first)) { System.out.println(firBox[0]); } else { System.out.println(secBox[0]); } } catch (Exception e) { e.printStackTrace(); } } }