import java.util.Scanner

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

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, Set[Int]] = MMap()
  val rail_connected_cities: MMap[Int, Set[Int]] = MMap()

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

  roads.foreach { case (p, q) =>
    val x = road_connected_cities(p) ++ road_connected_cities(q)
    x.foreach {
      road_connected_cities.put(_, x)
    }
  }

  rails.foreach { case (r, s) =>
    val x = rail_connected_cities(r) ++ rail_connected_cities(s)
    x.foreach {
      rail_connected_cities.put(_, x)
    }
  }

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

  println(ans)
}
