N = int(input()) a = input().split() b = input().split() for i in range(N): if a[i] != b[i]: print(i+1) print("{}\n{}".format(a[i], b[i])) exit()