import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String[] inputs = reader.readLine().split(" "); String SA = inputs[0]; BigInteger PA = new BigInteger(inputs[1]); inputs = reader.readLine().split(" "); String SB = inputs[0]; BigInteger PB = new BigInteger(inputs[1]); showResult(SA,SB,PA,PB); } private static void showResult(String playerA, String playerB, BigInteger pointA, BigInteger pointB) { if(pointA.compareTo(pointB) == 1) { System.out.println(playerA); } else if (pointA.compareTo(pointB)==0){ System.out.println("-1"); } else { System.out.println(playerB); } } }