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