import Control.Monad (replicateM)
import Data.List (intersperse, (\\), intersect, find)

main :: IO ()
main = do
  [n, k, l] <- fmap (map rInt . words) $ getLine
  ks <- fmap (map (map rInt . words)) $ getNLine_ k
  ls <- fmap (map (map rInt . words)) $ getNLine_ l
  putStrLn $
    (concat . intersperse " " . map (show . answer n ks ls)) [1..n]

-- 両方で連結している個数
answer :: Int -> [[Int]] -> [[Int]] -> Int -> Int
answer n ks ls k = length $ filter (ryouhou ks ls k) [1..n]

-- 両方で連結しているか
ryouhou :: [[Int]] -> [[Int]] -> Int -> Int -> Bool
ryouhou ks ls i j = (beConnected ks i j) && (beConnected ls i j)

-- 連結しているかどうか
beConnected :: [[Int]] -> Int -> Int -> Bool
beConnected xs i j
  | i == j = True
  | otherwise = or [elem [i,j] xs, elem [j,i] xs]

-- 複数行入力
getNLine_ :: Int -> IO [String]
getNLine_ n = replicateM n getLine

-- 文字列を整数に
rInt :: String -> Int
rInt str = read str :: Int