package m.shin; import java.util.Scanner; public class Con201 { public static void main(String[] args) { Scanner s = new Scanner(System.in); String sa = s.next() , pa = s.next() , xa = s.next(); String sb = s.next() , pb = s.next() , xb = s.next(); s.close(); if(pa.length() > pb.length()){ System.out.println(sa); }else if(pa.length() < pb.length()){ System.out.println(sb); }else{ for(int i = 0;i < pa.length();i++){ int a = Integer.parseInt(pa.substring(i , i+1)); int b = Integer.parseInt(pb.substring(i , i+1)); if(a > b){ System.out.println(sa); break; }else if(a < b){ System.out.println(sb); break; } if(i == pa.length() -1){ System.out.println(-1); } } } } }