(n,),a,b=$<.map{|l|l.split.map &:to_i}
c,d=[a,b].map{|z|(z<<F=z[J=0]).each_cons(2).map{|x,y|x^y}}
d+=m=[k=-1]
d.map{|x|k=m[k]until k<0||d[k]==x;m<<k+=1}
(2*n-1).times{|i|J=m[J]until J<0||d[J]==c[i%n];p i+=1-n,F^a[i]if n==J+=1}