n, l1, l2 = input(), input().split(), input().split() i = 0 while True: if l1[i] != l2[i]: print(f"{i+1}\n{l1[i]}\n{l2[i]}") break else: i += 1