i=input i() S=i().split() T=i().split() [print(S.index(a)+1,a,b,sep='\n') for a,b in zip(S,T) if a!=b]