n = int(input()) s = input().split() t = input().split() for i, (a, b) in enumerate(zip(s, t)): if a != b: print(i + 1) print(a) print(b) break