import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Control.Arrow
import Data.Ord
import Data.Maybe
import Numeric
import Data.Char
import Text.Printf
import qualified Data.IntMap.Strict as IM

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine


r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine


main :: IO ()
main = do
    [n,m] <- r'
    mapM_ (printTup.solve (2*m+1)) [1..m]


solve n x = (1 + x `mod` n, 1 + ((-x)`mod` n ) )


printTup (a,b) = putStrLn $ show a ++ " " ++ show b

di x y = ceiling (fromIntegral x / fromIntegral y)


