input() S = input().split() T = input().split() for idx,st in enumerate(zip(S,T)): s,t = st if s != t: break idx+=1 print(idx) print(s) print(t)