program xor_shift
  implicit none
  integer :: n, k, i, x
  integer :: a(0:200000) = 0, b(0:200000) = 0
  read(*,*) n
  read(*,*) a(0:n-1)
  read(*,*) b(0:n-1)
  do k = 0, n-1
    x = xor(a(k),b(0))
    do i = 0, n-1
      if (xor(a(mod(i+k,n)),b(i)) /= x) goto 100
    end do
    write(*,'(i0,x,i0)') k, x
100 end do
end program xor_shift