N = int(input()) S = input().split() T = input().split() for idx,it in enumerate(zip(S, T)): if it[0] != it[1]: idx += 1 break print(idx) print(it[0]) print(it[1])