import java.util.Scanner

import scala.collection.mutable.{Map => MMap}
import scala.collection.mutable.{Set => MSet}

object Main extends App {
  val sc = new Scanner(System.in)
  val (n, k, l) = (sc.nextInt, sc.nextInt, sc.nextInt)

  val roads = Seq.fill(k)((sc.nextInt, sc.nextInt))
  val rails = Seq.fill(l)((sc.nextInt, sc.nextInt))

  val road_connected_cities: MMap[Int, MSet[Int]] = MMap()
  val rail_connected_cities: MMap[Int, MSet[Int]] = MMap()

  Range(1, n + 1).foreach { x =>
    road_connected_cities.put(x, MSet(x))
    rail_connected_cities.put(x, MSet(x))
  }

  def calc(pairs: Seq[(Int, Int)], acc: MMap[Int, MSet[Int]]): Unit = {
    pairs.foreach { case (p, q) =>
      val x = acc(p)
      x ++= acc(q)
      acc.put(q, x)
    }
  }

  calc(roads, road_connected_cities)
  calc(rails, rail_connected_cities)

  val ans = Range(1, n + 1)
      .toList
      .map(x => (road_connected_cities(x) intersect rail_connected_cities(x)).size)
      .mkString(" ")

  println(ans)
}
