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