n=int(input()) a=input().split() b=input().split() c=1 for i,j in zip(a,b): if i!=j: print(c,i,j,sep="\n") break else: c+=1