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