import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String s = sc.next(); BigInteger b = new BigInteger(sc.next()); sc.next(); String t = sc.next(); BigInteger c = new BigInteger(sc.next()); sc.next(); if(b.compareTo(c)>0){ System.out.println(s); } else if(b.compareTo(c)==0){ System.out.println(-1); } else { System.out.println(t); } } }