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