from collections import * n, m, q = map(int, raw_input().split()) g = [set() for _ in xrange(n+1)] for _ in xrange(m): a, b = map(int, raw_input().split()) g[a].add(b) g[b].add(a) e = [] for _ in xrange(q): a, b = map(int, raw_input().split()) g[a].remove(b) g[b].remove(a) e.append((a,b)) g = [list(s) for s in g] r = [0]*(n+1) def bfs(i, x): q = deque([i]) while q: j = q.popleft() if r[j] != 0: continue r[j] = x q.extend(g[j]) bfs(1, -1) for i, j in e[::-1]: g[i].append(j) g[j].append(i) if not r[i]==r[j]==0: bfs(i, q) bfs(j, q) q -= 1 for i in r[2:]: print(i)