import Control.Monad (replicateM)
import Data.List (intersperse)
import Data.Set (Set, empty, singleton, member, union, foldr, intersection, size)
import qualified Data.Map.Strict as M

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) $
    map (\i -> size $ intersection (func i $ groupCity n ks) (func i $ groupCity n ls)) [1..n]
    where func i = (\(Just m) -> m) . M.lookup i

groupCity :: Int -> [[Int]] -> M.Map Int (Set Int)
groupCity n [] = M.fromList $ zip [1..n] (map Data.Set.singleton [1..n])
groupCity n ([a,b]:xs) = if member b ((\(Just m) -> m) $ M.lookup a done)
    then done
    else Data.Set.foldr (\k dn -> M.update (\_ -> Just doneab) k dn) done doneab
  where done = groupCity n xs
        doneab = union ((\(Just m) -> m) $ M.lookup a done) ((\(Just m) -> m) $ M.lookup b done)

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

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