N = int(raw_input()) S = raw_input().split() T = raw_input().split() for i in range(0, N): if S[i] != T[i]: print i+1 print S[i] print T[i] break