import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) S = readline().decode().split() T = readline().decode().split() for i,(s,t) in enumerate(zip(S,T)): if s != t: answer = str(i+1), s, t break print('\n'.join(answer))