import Prelude hiding (abs)
import Control.Monad
import Data.List (sort, group)

main :: IO ()
main = do
    [n,m] <- (map read . words) <$> getLine
    abs <- map readLine2 <$> replicateM n getLine
    mapM_ print $ solve n abs

-- |
--
-- >>> solve 4 [(1,2),(2,3),(1,4)]
-- [2,2,1,1]
solve :: Int -> [(Int,Int)] -> [Int]
solve n abs = map length $ group . sort $ as ++ bs
  where (as, bs) = unzip abs

readLine2 :: String -> (Int,Int)
readLine2 = tuplify2 . map read . words
    where
      tuplify2 [] = (0, 0)
      tuplify2 [x] = (x, 0)
      tuplify2 (x:y:_) = (x, y)
