from itertools import permutations import sys sys.setrecursionlimit(10 ** 6) from bisect import * from collections import * from heapq import * def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def SI(): return sys.stdin.readline()[:-1] def LLI(rows_number): return [LI() for _ in range(rows_number)] def LLI1(rows_number): return [LI1() for _ in range(rows_number)] int1 = lambda x: int(x) - 1 def MI1(): return map(int1, sys.stdin.readline().split()) def LI1(): return list(map(int1, sys.stdin.readline().split())) p2D = lambda x: print(*x, sep="\n") dij = [(1, 0), (0, 1), (-1, 0), (0, -1)] class UnionFind: def __init__(self, n): self.state = [-1] * n self.member=[[i] for i in range(n)] def root(self, u): v = self.state[u] if v < 0: return u self.state[u] = res = self.root(v) return res def merge(self, u, v): res=[] ru = self.root(u) rv = self.root(v) if ru == rv: return res if ru > rv: ru, rv = rv, ru if ru==0:res=self.member[rv] else:self.member[ru]+=self.member[rv] self.state[rv] = ru return res def main(): # 橋を壊していくのではなく、クエリを逆順にして、橋をつないでいく n,m,q=MI() ab=LLI1(m) cd=LLI1(q) uf=UnionFind(n) # 破壊される橋をチェック des=[[False]*n for _ in range(n)] for c,d in cd:des[c][d]=des[d][c]=True # 破壊されない橋を結ぶ ans=[0]*n for a,b in ab: if des[a][b]:continue uu=uf.merge(a,b) for u in uu:ans[u]=-1 # クエリを逆から見て橋をつないでいく for i,(c,d) in enumerate(cd[::-1]): uu=uf.merge(c,d) for u in uu:ans[u]=q-i for i in range(1,n):print(ans[i]) main()