import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import Data.Array.IO
import Data.List
import Control.Monad

type Memo = IOUArray Int Int
type Edge = (Int, Int)

main = do
  [n,k,l] <- map read . words <$> getLine :: IO [Int]
  road <- (\[x, y] -> zip x y) . transpose <$> replicateM k getIntListBC
  railway <- (\[x, y] -> zip x y) . transpose <$> replicateM l getIntListBC
  repRoad <- newArray (1, n) 0 :: IO Memo
  repRailway <- newArray (1, n) 0 :: IO Memo
  unionFind repRoad road
  unionFind repRailway railway
  ans <- mapM (count repRoad repRailway n) [1..n]
  putStrLn . unwords . map show $ ans

unionFind :: Memo -> [Edge] -> IO Memo
unionFind memo [] = return memo
unionFind memo ((i, j):es) = do
  pI <- getRepresentative memo i
  pJ <- getRepresentative memo j
  if pI == pJ then unionFind memo es
              else do
                writeArray memo pI pJ
                unionFind memo es

getRepresentative :: Memo -> Int -> IO Int
getRepresentative memo i = do
  parent <- readArray memo i
  case parent of
    0 -> return i
    _ -> do
      pp <- getRepresentative memo parent
      writeArray memo i pp
      return pp

count :: Memo -> Memo -> Int -> Int -> IO Int
count road railway n i = do
  pI <- getRepresentative road i
  qI <- getRepresentative railway i
  return =<< sum <$> mapM (count' pI qI) [1..n]
    where count' :: Int -> Int -> Int -> IO Int
          count' pI qI j = do
            pJ <- getRepresentative road j
            qJ <- getRepresentative railway j
            if pI == pJ && qI == qJ
              then return 1
              else return 0

bsToInt :: BC.ByteString -> Int
bsToInt = fst . fromJust . BC.readInt

getIntListBC :: IO [Int]
getIntListBC = map bsToInt . BC.words <$> BC.getLine
