sa,pa,xa=STDIN.gets.split(" ") sb,pb,xb=STDIN.gets.split(" ") sc=[sa,sb] pa=pa.to_i pb=pb.to_i if pa==0 && pb==0 puts -1 elsif pa>pb puts sa elsif pa