N = int(input()) S = [str(i) for i in input().split()] T = [str(i) for i in input().split()] for i in range(N): if S[i] != T[i]: print(i+1, S[i], T[i], sep="\n") break