import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Test.HUnit

main :: IO ()
-- main = runTestTT (TestList tests) >> return ()
main = do
  m <- getl toInt
  n <- getl toInt
  xys <- rgetl n $ split toInt
  mapM_ print $ solve m n xys

solve :: Int -> Int -> [[Int]] -> [Int]
solve m n xys = ([1..m] \\ cs) ++ cs
  where
    cs = head $ foldl f [[2]] xys
    f lls xy = concat [insertP ls xy | ls <- lls]
    
insert1 :: [Int] -> Int -> Int -> [Int]
insert1 ls i x = as ++ (x:bs)
  where
    (as,bs) = splitAt i ls

insert2 :: [Int] -> Int -> Int -> Int -> Int -> [Int]
insert2 ls i j x y = as ++ (x:bs) ++ (y:cs)
  where
    (as,ds) = splitAt i ls
    (bs,cs) = splitAt (j - i) ds

insertP :: [Int] -> [Int] -> [[Int]]
insertP ls [x,y] = case (mi,mj) of
  (Nothing, Nothing) -> let l = length ls in [insert2 ls m n x y | m <- [0..l-1], n <- [m..l-1]]
  (Nothing, _) -> let l = length ls
                      j = maybe 0 id mj
                  in [insert1 ls m x | m <- [0..j]]
  (_, Nothing) -> let l = length ls
                      i = maybe 0 id mi
                  in [insert1 ls n y | n <- [i+1..l-1]]
  _ -> let i = maybe 0 id mi
           j = maybe 0 id mj
       in if i > j then [] else [ls]
  where
    mi = findIndex (== x) ls
    mj = findIndex (== y) ls
    
toInt :: String -> Int
toInt s = read s

split :: (String -> a) -> String -> [a]
split f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine

rgetl :: Int -> (String -> a) -> IO [a]
rgetl n f = map f <$> replicateM n getLine