import sys; input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) class UnionFind: def __init__(self, n): self.par = [i for i in range(n + 1)] self.rank = [0] * (n + 1) self.cnt = [INF] * (n + 1) self.cnt[0] = -1 def ansfind(self, x): while True: if self.cnt[x] != INF: return self.cnt[x] else: x = self.par[x] if x == self.par[x] and self.cnt[x] == INF: return INF def find(self, x): while True: if self.par[x] == x: return x else: x = self.par[x] # if self.par[x] == x: # return x # else: # self.par[x] = self.find(self.par[x]) # return self.par[x] def same_check(self, x, y): return self.find(x) == self.find(y) def union(self, x, y, itr): x2 = self.find(x); y2 = self.find(y) root = self.find(0) if x2 != root and y2 != root: if self.rank[x2] < self.rank[y2]: self.par[x2] = y2 else: self.par[y2] = x2 if self.rank[x2] == self.rank[y2]: self.rank[x2] += 1 return if y2 == root: x2, y2, x, y = y2, x2, y, x if self.rank[x2] < self.rank[y2]: self.par[x2] = y2 self.cnt[y2] = itr else: self.par[y2] = x2 self.cnt[y2] = itr if self.rank[x2] == self.rank[y2]: self.rank[x2] += 1 return #処理内容 def main(): N, M, Q = getlist() UF = UnionFind(N) edge = defaultdict(int) for i in range(M): A, B = getlist() A -= 1; B -= 1 edge[A * (10 ** 6) + B] = 1 bridge = [] for i in range(Q): C, D = getlist() C -= 1; D -= 1 bridge.append([C, D]) edge[C * (10 ** 6) + D] = 0 for key, value in edge.items(): if value == 1: a, b = int(key // (10 ** 6)), key % (10 ** 6) if not UF.same_check(a, b): UF.union(a, b, -1) # print(UF.par) for i in range(Q): c, d = bridge[-1 - i] if not UF.same_check(c, d): UF.union(c, d, i) # print(UF.cnt) # print(UF.par) for i in range(1, N): anspre = UF.ansfind(i) if anspre == INF: print(0) elif anspre == -1: print(-1) else: print(Q - anspre) if __name__ == '__main__': main()