N = int(input()) S = list(input().split()) T = list(input().split()) count = 0 while S[count] == T[count]: count += 1 print(count+1) print(S[count]) print(T[count])