n=input() s=input().split() t=input().split() for i,st in enumerate(zip(s,t)): s,t=st if s!=t: print(i+1,s,t,sep='\n');exit()