import qualified Data.Map as Map
import qualified Data.Set as Set

main :: IO ()
main = mapM_ print . solve . map (map read . words) . lines =<< getContents

solve :: [[Int]] -> [Int]
solve ([h, w, _] : xs) = [ Map.findWithDefault 0 j ms | j <- [0..9] ]
  where abs' = Set.fromList (map toTuple xs)
        ys = [ [ (x, y) `elem` abs' | x <- [1..h] ] | y <- [1..w] ]
        go m zs | any null zs = m
                | otherwise = let m' = Map.insertWith (+) z 1 m in m' `seq` go m' ys'
          where (xs', ys') = (map head zs, map tail zs)
                z = length $ filter id xs'
        ms = go Map.empty [ concat $ map (take (h - 2) . drop i) (take (w - 2) $ drop j ys) | i <- [0..2], j <- [0..2] ]
solve _ = undefined

toTuple :: [a] -> (a, a)
toTuple xs = (head xs, xs !! 1)
