import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String SPXA = sc.nextLine(); String [] arrA = SPXA.split(" "); String SPXB = sc.nextLine(); String [] arrB = SPXB.split(" "); int flag =0; if( arrA[1].length() > arrB[1].length() ){ flag=1; }else if( arrA[1].length() < arrB[1].length() ){ flag=2; }else{ for(int i=0; i arrB[1].charAt(i) ){ flag=1; break; }else if(arrA[1].charAt(i) < arrB[1].charAt(i) ){ flag=2; break; } } } if(flag==1){ System.out.println(arrA[0]); }else if(flag==2){ System.out.println(arrB[0]); }else{ System.out.println(-1); } } }