import Control.Monad (replicateM, forM_)
import Data.List (sort, group)

solve :: [[Int]] -> [Int] -> [[Int]] -> [[Int]]
solve acc [] xss = acc
solve acc (n:ns) [] = solve ([]:acc) ns []
solve acc (n:ns) (xs:xss) =
  if n == head xs
    then solve (xs:acc) ns xss
    else solve ([]:acc) ns (xs:xss)


main = do
  [n, m] <- fmap read <$> words <$> getLine :: IO [Int]
  xss <- fmap (fmap read) <$> fmap words <$> replicateM m getLine :: IO [[Int]]
  forM_ (fmap (show . length) . reverse . solve [] [1..n] . group . sort . concat $ xss) putStrLn
