n=int(input()) f=lambda:list(input().split()) s=f() t=f() for i in range(n): if s[i]!=t[i]: print(i+1) print(s[i]) print(t[i]) break