#include int main(void){ char a[100],b[100]; char x,y; long a1,b1; scanf("%s%ld%c",a,&a1,&x); scanf("%s%ld%c",b,&b1,&y); if(a1 == b1){ printf("-1\n"); }else if(a1 > b1){ printf("%s\n",a); }else if(b1 > a1){ printf("%s\n",b); } return 0; }