N = int(input().strip()) S = [i for i in input().strip().split(' ')] T = [i for i in input().strip().split(' ')] a, b, c = [[str(n + 1), x, y] for n, (x, y) in enumerate(zip(S, T)) if x != y][0] print(a) print(b) print(c)