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