# No.547 未知の言語 n = int(input()) s = [i for i in input().split()] t = [i for i in input().split()] for i in range(n): if s[i] != t[i]: print(i + 1) print(s[i]) print(t[i]) break