def main(): N = int(input()) S = [] T = [] S.append(input().split()) T.append(input().split()) for x in range(N): if S[0][x] != T[0][x]: print(x + 1) print(S[0][x]) print(T[0][x]) break if __name__ == "__main__": main()