n = int(input()) a = list(input().split()) b = list(input().split()) for i in range(n): if a[i] != b[i]: ans = i+1 break print(ans) print(a[ans-1]) print(b[ans-1])