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