open System

// input
let readStr () = stdin.ReadLine()

let readInt () = stdin.ReadLine() |> int
let readInts () = stdin.ReadLine().Split() |> Array.map int

// utils

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let inline flip f a b = f b a

let debug x =
  printfn "%A" x
  x

// memoization
let inline memo size f =
  let dp = Array.create size None
  let rec g st x =
    match dp.[x] with
    | None ->
      let v = f g st x
      dp.[x] <- Some v
      v
    | Some v -> v
  g

let inline memo2 size1 size2 f =
  let dp = Array2D.create size1 size2 None
  let rec g x y =
    match Array2D.get dp x y with
    | None ->
      let v = f g x y
      Array2D.set dp x y (Some v)
      v
    | Some v -> v
  g

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify array i f = Array.set array i (f (Array.get array i))

module Lazy =
  let force (lazyVal: _ Lazy) = lazyVal.Force()

type GraphData = (int list) array
type Edge = int * int
module Graph =
  let build (verticesCount: int) (edges: Edge seq) =
    let g: GraphData = Array.create verticesCount []
    Seq.iter (fun (from, to') -> Array.modify g from (fun xs -> to'::xs)) edges
    g
  let vertices (g: GraphData) = seq { 0..(g.Length - 1) }
  let edges (g: GraphData) =
    seq {
      for i in 0..(g.Length - 1) do
        yield! g.[i] |> List.map (fun to' -> (i, to'))
    }
  let dfs (vertices: int seq) (g: GraphData): int seq seq =
    let rec f seen v =
      if Array.get seen v
      then (Seq.empty: int seq), seen
      else
        Array.set seen v true
        let neighbor = Array.get g v
        let (result, seen') =
          neighbor
          |> List.mapFold f seen
        seq {
          yield v        
          yield! Seq.concat result
        }, seen'
    vertices
    |> Seq.mapFold f (Array.create (g.Length) false)
    |> fst
  
  let components (g: GraphData): int seq seq =
    g
    |> dfs (seq{ 0..(g.Length-1)})
    |> Seq.filter (not << Seq.isEmpty)

module Undirected =
  let build (verticesCount: int) (edges: Edge seq) =
    let ud =
      edges
      |> Seq.collect (fun (a, b) -> [(a, b); (b, a)])
    Graph.build verticesCount ud

let N,M,K = readInts() |> triple

let readGraph edgeCount =
  let edges = seq { for _ in 1..edgeCount -> readInts() |> Array.map (flip (-) 1) |> pair }
  Undirected.build N edges

let friends = readGraph M

let blocks = readGraph K

let components =
  friends
  |> Graph.components
  |> Seq.map Seq.toList

let groups =
  components
  |> Seq.mapi (fun i x -> (i, x))
  |> Seq.collect (fun (i, list) -> list |> List.map (fun x -> (x, i)))
  |> Map.ofSeq

let resultMap =
  let tmp =
    components
    |> Seq.collect (fun list ->
      let len = list |> List.length
      List.map (fun x -> x, len - List.length friends.[x] - 1) list)
    |> Map.ofSeq
  tmp

let result =
  seq { 0..(N-1) }
  |> Seq.map (flip Map.find resultMap)
  |> Seq.toArray

blocks
|> Graph.edges
|> Seq.iter (fun (a, b) -> do
  if Map.find a groups = Map.find b groups then Array.modify result a (flip (-) 1)
)

result
|> Array.iter (printf "%d ")