N = int(input())
S = input().split()
T = input().split()
for i, st in enumerate(zip(S, T)):
    if st[0]!=st[1]:
        print(i+1)
        print(st[0])
        print(st[1])
        exit()