import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector as V
import Data.Bits

main :: IO ()
main = do
  (n : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  as <- V.fromList . map unsafeSignedDecimal . T.words <$> T.getLine :: IO (V.Vector Int)
  bs <- V.fromList . map unsafeSignedDecimal . T.words <$> T.getLine :: IO (V.Vector Int)
  let
    f :: Int -> Int -> Int
    f k = \i -> (as V.! ((i + k) `mod` n)) `xor` (bs V.! i)
    cs = V.generate n (\k -> if all (f k 0 ==) . map (f k) $ [1..(pred n)] then putStrLn (show k ++ " " ++ show (f k 0)) else return ())
  V.sequence_ cs

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n
