while true do a,b=io.read("*n","*n")io.write(a%10==(a%100-a%10)/10 and a%10 or (b-b%100)/100)end