AtCoder Beginner Contest 157 - Friend Suggestions

An SNS has N users - User 1, User 2, \cdots, User N.
Between these N users, there are some relationships - M friendships and K blockships.
For each i = 1, 2, \cdots, M, there is a bidirectional friendship between User A_i and User B_i.
For each i = 1, 2, \cdots, K, there is a bidirectional blockship between User C_i and User D_i.
We define User a to be a friend candidate for User b when all of the following four conditions are satisfied:
 - a \neq b.
 - There is not a friendship between User a and User b.
 - There is not a blockship between User a and User b.
 - There exists a sequence c_0, c_1, c_2, \cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \cdots, L - 1.
For each user i = 1, 2, ... N, how many friend candidates does it have?

-----Constraints-----
 - All values in input are integers.
 - 2 ≤ N ≤ 10^5
 - 0 \leq M \leq 10^5
 - 0 \leq K \leq 10^5
 - 1 \leq A_i, B_i \leq N
 - A_i \neq B_i
 - 1 \leq C_i, D_i \leq N
 - C_i \neq D_i
 - (A_i, B_i) \neq (A_j, B_j) (i \neq j)
 - (A_i, B_i) \neq (B_j, A_j)
 - (C_i, D_i) \neq (C_j, D_j) (i \neq j)
 - (C_i, D_i) \neq (D_j, C_j)
 - (A_i, B_i) \neq (C_j, D_j)
 - (A_i, B_i) \neq (D_j, C_j)

-----Input-----
Input is given from Standard Input in the following format:
N M K
A_1 B_1
\vdots
A_M B_M
C_1 D_1
\vdots
C_K D_K

-----Output-----
Print the answers in order, with space in between.

-----Sample Input-----
4 4 1
2 1
1 3
3 2
3 4
4 1

-----Sample Output-----
0 1 0 1

There is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.
However, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.

Source: atcoder | Difficulty: MEDIUM


Solutions:
def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def unite(x, y):
	(x, y) = (find(x), find(y))
	if x != y:
		if x > y:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x

def same(x, y):
	return find(x) == find(y)

def size(x):
	return -par[find(x)]
(N, M, K) = map(int, input().split())
par = [-1] * N
B = [set() for _ in range(N)]
FF = [0] * N
for _ in range(M):
	(a, b) = map(int, input().split())
	unite(a - 1, b - 1)
	FF[a - 1] += 1
	FF[b - 1] += 1
for j in range(K):
	(a, b) = map(int, input().split())
	B[a - 1].add(b - 1)
	B[b - 1].add(a - 1)
Y = []
for i in range(N):
	y = size(i) - FF[i] - 1
	for b in B[i]:
		if same(i, b):
			y += -1
	Y.append(str(y))
print(' '.join(Y))


(N, M, K) = map(int, input().split())
par = [-1] * N
num = [0] * N

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def union(x, y):
	(p, q) = (find(x), find(y))
	if p == q:
		return
	if p > q:
		(p, q) = (q, p)
	par[p] += par[q]
	par[q] = p

def size(x):
	return -par[find(x)]

def same(x, y):
	return find(x) == find(y)
for _ in range(M):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	union(a, b)
	num[a] += 1
	num[b] += 1
for _ in range(K):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	if same(c, d):
		num[c] += 1
		num[d] += 1
for i in range(N):
	print(size(i) - 1 - num[i], end=' ')


from collections import defaultdict
(N, M, K) = map(int, input().split())
friends = defaultdict(list)
blocked = defaultdict(list)
for i in range(M):
	(a, b) = map(int, input().split())
	friends[a - 1].append(b - 1)
	friends[b - 1].append(a - 1)
for j in range(K):
	(c, d) = map(int, input().split())
	blocked[c - 1].append(d - 1)
	blocked[d - 1].append(c - 1)
groups = {}
for i in range(N):
	if i in groups:
		continue
	group = {i}
	stack = [(i, None)]
	while stack:
		(j, parent_id) = stack.pop()
		group.add(j)
		groups[j] = group
		for k in friends[j]:
			if k != parent_id and k not in groups:
				stack.append((k, j))
ans = []
for i in range(N):
	g = groups[i]
	res = len(g) - len(friends[i]) - 1
	for b in blocked[i]:
		if groups[b] is g:
			res -= 1
	ans.append(res)
print(*ans)


import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
import sys
sys.setrecursionlimit(10 ** 9)
(n, m, k) = [int(i) for i in input().split()]
frends_num = [0 for i in range(n)]

def make_frends(m, n):
	data = [1 for i in range(m)]
	row = []
	col = []
	for k in range(m):
		(i, j) = [int(l) for l in input().split()]
		new_i = min(i, j) - 1
		new_j = max(i, j) - 1
		row.append(new_i)
		col.append(new_j)
		frends_num[new_i] += 1
		frends_num[new_j] += 1
	frend_sparce_matrix = csr_matrix((data, (row, col)), shape=(n, n))
	return frend_sparce_matrix
frends = make_frends(m, n)
(l, labels) = connected_components(frends)
labels
labels = list(labels)

class Group:

	def __init__(self, labels):
		self.labels = labels
		self.group_num = [0 for i in range(l)]
		for i in labels:
			self.group_num[i] += 1

	def get_group_num(self, i):
		return self.group_num[self.labels[i]]
group = Group(labels)

def get_frend_num(i):
	return frends_num[i]

def make_block(k, n):
	block_num = [0 for i in range(n)]
	for p in range(k):
		(i, j) = [int(l) - 1 for l in input().split()]
		new_i = min(i, j)
		new_j = max(i, j)
		if labels[new_i] == labels[new_j]:
			block_num[i] += 1
			block_num[j] += 1
	return block_num
block = make_block(k, n)

def get_block_num(i):
	return block[i]
ans = []
for i in range(n):
	ans.append(str(group.get_group_num(i) - 1 - get_frend_num(i) - get_block_num(i)))
print(' '.join(ans))


from collections import deque
(n, m, k) = map(int, input().split())
fl = [set() for _ in range(n + 1)]
bl = [set() for _ in range(n + 1)]
for i in range(m):
	(a, b) = map(int, input().split())
	fl[a].add(b)
	fl[b].add(a)
for i in range(k):
	(c, d) = map(int, input().split())
	bl[c].add(d)
	bl[d].add(c)
stack = deque()
ans = [0] * (n + 1)
visited = [0] * (n + 1)
for i in range(1, n + 1):
	if visited[i]:
		continue
	link = {i}
	visited[i] = 1
	stack.append(i)
	while stack:
		n = stack.pop()
		for j in fl[n]:
			if visited[j] == 0:
				stack.append(j)
				visited[j] = 1
				link.add(j)
	for i in link:
		ans[i] = len(link) - len(link & fl[i]) - len(link & bl[i]) - 1
print(*ans[1:])


(n, m, k) = map(int, input().split())
ab = []
for i in range(m):
	(a, b) = map(int, input().split())
	ab.append((a - 1, b - 1))
cd = []
for i in range(k):
	(c, d) = map(int, input().split())
	cd.append((c - 1, d - 1))

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def unite(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return False
	else:
		if par[x] > par[y]:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x
		return True

def same(x, y):
	return find(x) == find(y)

def size(x):
	return -par[find(x)]
par = [-1] * n
for (a, b) in ab:
	unite(a, b)
dp1 = [0] * n
for i in range(n):
	dp1[i] = size(i) - 1
for (a, b) in ab:
	dp1[a] -= 1
	dp1[b] -= 1
for (c, d) in cd:
	if same(c, d):
		dp1[c] -= 1
		dp1[d] -= 1
print(' '.join(map(str, dp1)))


class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join(('{}: {}'.format(r, self.members(r)) for r in self.roots()))
(n, m, k) = map(int, input().split())
a = [list(map(int, input().split())) for i in range(m)]
b = [0] * n
uf = UnionFind(n)
for i in range(m):
	uf.union(a[i][0] - 1, a[i][1] - 1)
for i in range(m + k):
	x = list(map(int, input().split())) if i >= m else a[i]
	if uf.same(x[0] - 1, x[1] - 1):
		b[x[0] - 1] += 1
		b[x[1] - 1] += 1
for i in range(n):
	print(uf.size(i) - 1 - b[i], end=' ')


(N, M, K) = map(int, input().split())
par = [-1] * N

def find(x):
	if par[x] < 0:
		return x
	else:
		tank = []
		while par[x] >= 0:
			tank.append(x)
			x = par[x]
		for elt in tank:
			par[elt] = x
		return x

def unite(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return False
	else:
		if find(x) > find(y):
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x
		return True
frbl = [0] * N
for i in range(M):
	(a, b) = sorted(map(int, input().split()))
	unite(a - 1, b - 1)
	frbl[a - 1] += 1
	frbl[b - 1] += 1
block = [0] * N
for i in range(K):
	(c, d) = sorted(map(int, input().split()))
	if find(c - 1) == find(d - 1):
		frbl[c - 1] += 1
		frbl[d - 1] += 1
list = []
for i in range(N):
	list.append(max(-par[find(i)] - frbl[i] - 1, 0))
print(*list)


from collections import deque, Counter
(n, m, k) = map(int, input().split())
frd = [[] for _ in range(n)]
blk = [[] for _ in range(n)]
for _ in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	frd[a].append(b)
	frd[b].append(a)
for _ in range(k):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	blk[c].append(d)
	blk[d].append(c)
ucnt = 0
uni = [-1] * n
stk = deque()
for i in range(n):
	if uni[i] != -1:
		continue
	stk.append((i, -1))
	while stk:
		(cur, prev) = stk.pop()
		uni[cur] = ucnt
		for nxt in frd[cur]:
			if nxt == prev:
				continue
			if uni[nxt] != -1:
				continue
			stk.append((nxt, cur))
	ucnt += 1
cnt = Counter(uni)
for i in range(n):
	ans = cnt[uni[i]] - 1
	for f in frd[i]:
		if uni[i] == uni[f]:
			ans -= 1
	for b in blk[i]:
		if uni[i] == uni[b]:
			ans -= 1
	print(ans, end=' ')


(n, m, k) = map(int, input().split())

def root(x):
	while par[x] >= 0:
		x = par[x]
	return x

def unite(x, y):
	(x, y) = (root(x), root(y))
	if x != y:
		if x > y:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x
par = [-1] * n

def same(x, y):
	return root(x) == root(y)

def size(x):
	return -par[root(x)]
g = [[] for _ in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	unite(a, b)
	g[a].append(b)
	g[b].append(a)
ss = [size(i) - len(g[i]) - 1 for i in range(n)]
for i in range(k):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	if same(c, d):
		ss[c] -= 1
		ss[d] -= 1
print(*ss)


(n, m, k) = map(int, input().split())

class UnionFind:

	def __init__(self, n):
		self.n = n
		self.par = [-1 for i in range(self.n)]

	def find(self, x):
		if self.par[x] < 0:
			return x
		else:
			self.par[x] = self.find(self.par[x])
			return self.par[x]

	def unite(self, x, y):
		p = self.find(x)
		q = self.find(y)
		if p == q:
			return None
		if p > q:
			(p, q) = (q, p)
		self.par[p] += self.par[q]
		self.par[q] = p

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def size(self, x):
		return -self.par[self.find(x)]
UF = UnionFind(n)
f_or_b = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	UF.unite(a - 1, b - 1)
	f_or_b[a - 1] += 1
	f_or_b[b - 1] += 1
for i in range(k):
	(c, d) = map(int, input().split())
	if UF.same(c - 1, d - 1):
		f_or_b[c - 1] += 1
		f_or_b[d - 1] += 1
for i in range(n):
	print(UF.size(i) - f_or_b[i] - 1, end=' ')


class UnionFind:

	def __init__(self, N):
		self.root = list(range(N + 1))
		self.size = [1] * (N + 1)

	def __getitem__(self, x):
		root = self.root
		while root[x] != x:
			root[x] = root[root[x]]
			x = root[x]
		return x

	def merge(self, x, y):
		x = self[x]
		y = self[y]
		if x == y:
			return
		(sx, sy) = (self.size[x], self.size[y])
		if sx < sy:
			(x, y) = (y, x)
			(sx, sy) = (sy, sx)
		self.root[y] = x
		self.size[x] += sy

def graph_input(N, M):
	G = [[] for _ in range(N + 1)]
	for _ in range(M):
		(a, b) = list(map(int, input().split()))
		G[a].append(b)
		G[b].append(a)
	return G
(N, M, K) = list(map(int, input().split()))
friend = graph_input(N, M)
block = graph_input(N, K)
uf = UnionFind(N + 1)
for a in range(N + 1):
	for b in friend[a]:
		uf.merge(a, b)
answer = [0] * (N + 1)
for a in range(N + 1):
	n = uf.size[uf[a]] - 1
	for x in friend[a] + block[a]:
		if uf[a] == uf[x]:
			n -= 1
	answer[a] = n
print(' '.join(map(str, answer[1:])))


import sys
sys.setrecursionlimit(10 ** 9)
(N, M, K) = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
CD = [list(map(int, input().split())) for _ in range(K)]
V = [[] for _ in range(N)]
for (a, b) in AB:
	a -= 1
	b -= 1
	V[a].append(b)
	V[b].append(a)
L = [0 for _ in range(N)]

def dfs(u, l):
	L[u] = l
	for t in V[u]:
		if L[t] == 0:
			dfs(t, l)
l = 1
for i in range(N):
	if L[i] == 0:
		dfs(i, l)
		l += 1
C = {}
for ll in L:
	if ll in C:
		C[ll] += 1
	else:
		C[ll] = 1
ans = [C[L[i]] - 1 for i in range(N)]
for (a, b) in AB:
	a -= 1
	b -= 1
	ans[a] -= 1
	ans[b] -= 1
for (c, d) in CD:
	c -= 1
	d -= 1
	if L[c] == L[d]:
		ans[c] -= 1
		ans[d] -= 1
print(*ans)


import sys
sys.setrecursionlimit(10 ** 6)
(N, M, K) = map(int, input().split())
par = [i for i in range(N + 1)]

def root(x):
	if par[x] == x:
		return x
	else:
		par[x] = root(par[x])
		return par[x]

def bool_same(x, y):
	return root(x) == root(y)

def unite(x, y):
	x = root(x)
	y = root(y)
	if x != y:
		par[x] = y
AB = [list(map(int, input().split())) for i in range(M)]
CD = [list(map(int, input().split())) for i in range(K)]
for (a, b) in AB:
	unite(a, b)
for i in range(N + 1):
	root(i)
member = [0 for i in range(N + 1)]
for p in par:
	member[p] += 1
ans = [member[par[i]] - 1 for i in range(N + 1)]
for (a, b) in AB:
	if bool_same(a, b):
		ans[a] -= 1
		ans[b] -= 1
for (c, d) in CD:
	if bool_same(c, d):
		ans[c] -= 1
		ans[d] -= 1
print(' '.join(map(str, ans[1:])))


import sys
sys.setrecursionlimit(10 ** 9)
(n, m, k) = map(int, input().split())
friend = [[] for _ in range(n)]
block = [[] for _ in range(n)]
for _ in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	friend[a].append(b)
	friend[b].append(a)
for _ in range(k):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	block[c].append(d)
	block[d].append(c)
seen = [-1] * n

def dfs(graph, v, top):
	seen[v] = top
	top_count[top] += 1
	for nv in graph[v]:
		if seen[nv] != -1:
			continue
		dfs(graph, nv, top)
top = 0
top_count = [0]
for v in range(n):
	count = 0
	if seen[v] != -1:
		continue
	dfs(friend, v, top)
	top_count.append(0)
	top += 1
for i in range(n):
	ans = top_count[seen[i]] - len(friend[i]) - 1
	cnt = 0
	for v in block[i]:
		if seen[v] == seen[i]:
			cnt += 1
	ans -= cnt
	print(ans, end=' ')


import sys
sys.setrecursionlimit(10 ** 7)
(n, m, k) = map(int, input().split())
r = [[] for i in range(n)]
bk = [[] for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	r[a - 1].append(b - 1)
	r[b - 1].append(a - 1)
for i in range(k):
	(c, d) = map(int, input().split())
	bk[c - 1].append(d - 1)
	bk[d - 1].append(c - 1)
v = [0] * n
l = [0] * n
w = [0] * n

def dfs(now, c):
	global ln
	if v[now] == 1:
		return
	v[now] = 1
	ln += 1
	w[now] = c
	l[c] = ln
	for i in r[now]:
		dfs(i, c)
	return
for i in range(n):
	ln = 0
	dfs(i, i)
ans = []
for i in range(n):
	d = 0
	for j in bk[i]:
		if w[j] == w[i]:
			d += 1
	ans.append(str(l[w[i]] - 1 - d - len(r[i])))
print(' '.join(ans))


(N, M, K) = map(int, input().split())
F = [[] for _ in range(N)]
B = [[] for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	F[a].append(b)
	F[b].append(a)
for _ in range(K):
	(c, d) = map(int, input().split())
	(c, d) = (c - 1, d - 1)
	B[c].append(d)
	B[d].append(c)
D = {}
parent = [-1] * N
visited = [False] * N
for root in range(N):
	if visited[root]:
		continue
	D[root] = set([root])
	stack = [root]
	while stack:
		n = stack.pop()
		visited[n] = True
		parent[n] = root
		for to in F[n]:
			if visited[to]:
				continue
			D[root].add(to)
			stack.append(to)
ans = [0] * N
for iam in range(N):
	group = D[parent[iam]]
	tmp_ans = len(group) - len(F[iam]) - 1
	for block in B[iam]:
		if block in group:
			tmp_ans -= 1
	ans[iam] = tmp_ans
print(*ans, sep=' ')


import sys
input = sys.stdin.readline
from collections import Counter
(N, M, K) = map(int, input().split())
friend = [[] for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split())
	friend[a - 1].append(b - 1)
	friend[b - 1].append(a - 1)
block = [[] for _ in range(N)]
for _ in range(K):
	(c, d) = map(int, input().split())
	block[c - 1].append(d - 1)
	block[d - 1].append(c - 1)
visited = [-1] * N
color = 0
for i in range(N):
	if visited[i] == -1:
		q = [i]
		visited[i] = color
		while q:
			cur = q.pop()
			for nex in friend[cur]:
				if visited[nex] >= 0:
					continue
				visited[nex] = color
				q.append(nex)
		color += 1
cnt = Counter(visited)
ret = []
for i in range(N):
	s = cnt[visited[i]]
	for j in block[i]:
		if visited[i] == visited[j]:
			s -= 1
	ret.append(s - len(friend[i]) - 1)
print(*ret)


(N, M, K) = map(int, input().split())
p = [i for i in range(N)]
r = [0] * N

def find(x):
	if p[x] == x:
		return x
	else:
		p[x] = find(p[x])
		return p[x]

def unite(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return
	if r[x] < r[y]:
		p[x] = y
	else:
		p[y] = x
		if r[x] == r[y]:
			r[x] += 1
nc = [1] * N
f = [0] * N
for i in range(M):
	(a, b) = map(int, input().split())
	nc[a - 1] += 1
	nc[b - 1] += 1
	unite(a - 1, b - 1)
for i in range(K):
	(c, d) = map(int, input().split())
	if find(c - 1) == find(d - 1):
		nc[c - 1] += 1
		nc[d - 1] += 1
for i in range(N):
	f[find(i)] += 1
print(*[f[find(i)] - nc[i] for i in range(N)])


(n, m, k) = map(int, input().split())
clusterN = [1] * n
clusterI = list(range(n))
out = [0] * n

def find(x):
	if clusterI[x] != x:
		minI = find(clusterI[x])
		clusterI[x] = minI
		return minI
	else:
		return x

def unite(x, y):
	CX = find(x)
	CY = find(y)
	if CX != CY:
		if CX > CY:
			(CX, CY) = (CY, CX)
			(x, y) = (y, x)
		clusterN[CX] += clusterN[CY]
		clusterI[CY] = CX
for _ in range(m):
	(a, b) = map(int, input().split())
	unite(a - 1, b - 1)
	out[a - 1] -= 1
	out[b - 1] -= 1
for _ in range(k):
	(a, b) = map(int, input().split())
	if find(a - 1) == find(b - 1):
		out[a - 1] -= 1
		out[b - 1] -= 1
out = [out[i] + clusterN[find(i)] - 1 for i in range(n)]
print(*out)


class Union_Find:

	def __init__(self, n=0):
		self.vertices = n
		self.mother = [-1 for i in range(self.vertices)]
		self.size_temp = [1 for i in range(self.vertices)]

	def root(self, x):
		normalize_v = []
		while x != -1:
			normalize_v.append(x)
			y = x
			x = self.mother[x]
		for i in normalize_v[:-1]:
			self.mother[i] = y
		return y

	def union(self, x, y):
		root_x = self.root(x)
		root_y = self.root(y)
		if root_x != root_y:
			self.mother[root_x] = root_y
			self.size_temp[root_y] += self.size_temp[root_x]

	def find(self, x, y):
		if self.root(x) == self.root(y):
			return True
		else:
			return False

	def size(self, x):
		return self.size_temp[self.root(x)]
(n, m, k) = list(map(int, input().split()))
uf = Union_Find(n)
friend = [0 for i in range(n)]
block = [[] for i in range(n)]
for i in range(m):
	(a, b) = [int(x) - 1 for x in input().split()]
	friend[a] += 1
	friend[b] += 1
	uf.union(a, b)
for i in range(k):
	(a, b) = [int(x) - 1 for x in input().split()]
	block[a].append(b)
	block[b].append(a)
r = ''
for i in range(n):
	size = uf.size(i)
	size -= friend[i]
	for j in block[i]:
		if uf.find(i, j):
			size -= 1
	r += str(size - 1) + ' '
print(r[:-1])


(N, M, K) = map(int, input().split())
fr = [[] for i in range(N + 1)]
bl = [[] for i in range(N + 1)]
for _ in range(M):
	(A, B) = map(int, input().split())
	fr[A].append(B)
	fr[B].append(A)
for _ in range(K):
	(C, D) = map(int, input().split())
	bl[C].append(D)
	bl[D].append(C)
leader = [0] * (N + 1)
d = {}
for root in range(1, N + 1):
	if leader[root] != 0:
		continue
	d[root] = set([root])
	stack = [root]
	while stack:
		start = stack.pop()
		leader[start] = root
		for v in fr[start]:
			if leader[v] != 0:
				continue
			d[root].add(v)
			stack.append(v)
ans = [0] * (N + 1)
for i in range(1, N + 1):
	cluster = d[leader[i]]
	ans[i] = len(cluster) - len(fr[i]) - 1
	for b in bl[i]:
		if b in cluster:
			ans[i] -= 1
print(*ans[1:])


r = lambda x: p[x] >= 0 and r(p[x]) or x
((n, m, k), *t) = [map(int, t.split()) for t in open(0)]
(p, s) = ([-1] * -~n, [-1] * -~n)
for (i, (a, b)) in enumerate(t):
	(x, y) = (r(a), r(b))
	if (x != y) * m > i:
		if x > y:
			(x, y) = (y, x)
		p[x] += p[y]
		p[y] = x
	if (x != y) * i < m:
		s[a] -= 1
		s[b] -= 1
for i in range(n + 1):
	s[i] -= p[r(i)]
print(*s[1:])


class UnionFind:

	def __init__(self, n):
		self.parents = [-1] * n

	def root(self, x):
		if self.parents[x] < 0:
			return x
		else:
			return self.root(self.parents[x])

	def unite(self, x, y):
		(x, y) = (self.root(x), self.root(y))
		if x == y:
			return
		else:
			if x > y:
				(x, y) = (y, x)
			self.parents[x] += self.parents[y]
			self.parents[y] = x
			return
(n, m, k) = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(k)]
u = UnionFind(n)
f = [set() for _ in range(n)]
l = [set() for _ in range(n)]
for (a, b) in ab:
	(a, b) = (a - 1, b - 1)
	f[a].add(b)
	f[b].add(a)
	u.unite(a, b)
for (c, d) in cd:
	(c, d) = (c - 1, d - 1)
	l[c].add(d)
	l[d].add(c)
ans = [0] * n
for i in range(n):
	r = u.root(i)
	bl = 0
	for j in l[i]:
		if u.root(j) == r:
			bl += 1
	ans[i] = -u.parents[r] - len(f[i]) - bl - 1
print(' '.join(list(map(str, ans))))


from sys import setrecursionlimit
setrecursionlimit(2 * 10 ** 9)
(N, M, K) = map(int, input().split())
friends = {i: set() for i in range(N)}
blocks = {i: set() for i in range(N)}
for _ in range(M):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	friends[a].add(b)
	friends[b].add(a)
for _ in range(K):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	blocks[a].add(b)
	blocks[b].add(a)
ans = [0] * N
visited = [False] * N

def DFS(u):
	if visited[u]:
		return
	visited[u] = True
	for v in friends[u]:
		s.add(v)
		DFS(v)
for u in range(N):
	if not visited[u]:
		s = set()
		DFS(u)
		l = len(s)
		for i in s:
			ans[i] += l - 1
			ans[i] -= len(blocks[i].intersection(s))
			ans[i] -= len(friends[i].intersection(s))
print(*ans)


import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
inp = sys.stdin.buffer.readline

def inpS():
	return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines
(N, M, K) = map(int, inp().split())
friends = [set() for _ in range(N + 1)]
blocked = [set() for _ in range(N + 1)]
for _ in range(M):
	(a, b) = map(int, inp().split())
	friends[a].add(b)
	friends[b].add(a)
for _ in range(K):
	(c, d) = map(int, inp().split())
	blocked[c].add(d)
	blocked[d].add(c)
checked = set()
ans = [0] * (N + 1)
for i in range(1, N + 1):
	if i in checked:
		continue
	chain = set()
	stack = list(friends[i])
	while stack:
		friend = stack.pop()
		if friend in checked:
			continue
		checked.add(friend)
		chain.add(friend)
		stack.extend(friends[friend])
	cnt = len(chain) - 1
	for c in chain:
		ans[c] += cnt - len(chain & (friends[c] | blocked[c]))
print(*ans[1:])


class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join(('{}: {}'.format(r, self.members(r)) for r in self.roots()))
(n, m, k) = map(int, input().split())
friend = [[] for _ in range(n)]
block = [[] for _ in range(n)]
a = UnionFind(n)
for i in range(m):
	(x, y) = map(int, input().split())
	friend[x - 1].append(y - 1)
	friend[y - 1].append(x - 1)
	a.union(x - 1, y - 1)
for i in range(k):
	(x, y) = map(int, input().split())
	block[x - 1].append(y - 1)
	block[y - 1].append(x - 1)
ans = []
for i in range(n):
	ans.append(a.size(i) - len(friend[i]) - sum((a.same(i, j) for j in block[i])) - 1)
print(*ans)


(n, m, k) = map(int, input().split())
import sys
sys.setrecursionlimit(10 ** 9)
root = [-1 for i in range(n + 1)]

def r(x):
	if root[x] < 0:
		return x
	else:
		root[x] = r(root[x])
		return root[x]

def unite(x, y):
	x = r(x)
	y = r(y)
	if x == y:
		return
	if x > y:
		(x, y) = (y, x)
	root[x] += root[y]
	root[y] = x
fre = [[] for _ in range(n + 1)]
bro = [[] for _ in range(n + 1)]
for i in range(m):
	(a, b) = map(int, input().split())
	unite(a, b)
	fre[a].append(b)
	fre[b].append(a)
for i in range(k):
	(a, b) = map(int, input().split())
	bro[a].append(b)
	bro[b].append(a)
ans = []
for i in range(1, n + 1):
	anser = -root[r(i)] - 1
	anser -= len(fre[i])
	for j in bro[i]:
		if r(i) == r(j):
			anser -= 1
	ans.append(str(anser))
print(' '.join(ans))


import math
from math import gcd, pi, sqrt
INF = float('inf')
MOD = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
import bisect
from collections import Counter, deque

def i_input():
	return int(input())

def i_map():
	return map(int, input().split())

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def main():

	class UnionFind:

		def __init__(self, n):
			self.par = [i for i in range(n + 1)]
			self.rank = [0] * (n + 1)
			self.size = [1] * (n + 1)

		def find(self, x):
			if self.par[x] == x:
				return x
			else:
				self.par[x] = self.find(self.par[x])
				return self.par[x]

		def union(self, x, y):
			x = self.find(x)
			y = self.find(y)
			if x == y:
				return
			if self.rank[x] < self.rank[y]:
				self.par[x] = y
				self.size[y] += self.size[x]
				self.size[x] = 0
			else:
				self.par[y] = x
				self.size[x] += self.size[y]
				self.size[y] = 0
				if self.rank[x] == self.rank[y]:
					self.rank[x] += 1

		def same(self, x, y):
			return self.find(x) == self.find(y)

		def all_find(self):
			for n in range(len(self.par)):
				self.find(n)
	(N, M, K) = i_map()
	tree = UnionFind(N)
	not_friend_candi = []
	for i in range(M):
		(A, B) = i_map()
		A -= 1
		B -= 1
		tree.union(A, B)
		not_friend_candi.append([A, B])
	tree.all_find()
	for j in range(K):
		(C, D) = i_map()
		C -= 1
		D -= 1
		not_friend_candi.append([C, D])
	ans = [0] * N
	for (i, j) in not_friend_candi:
		if tree.same(i, j):
			ans[i] -= 1
			ans[j] -= 1
	for i in range(N):
		p = tree.find(i)
		ans[i] += tree.size[p] - 1
	print(*ans)

def __starting_point():
	main()
__starting_point()


(n, m, k) = map(int, input().split())
par = [-1] * n

def findsize(x):
	temp = par[x]
	if temp < 0:
		return -1 * temp
	else:
		return findsize(temp)

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def unite(x, y):
	(px, py) = (find(x), find(y))
	if px == py:
		return False
	else:
		if px < py:
			(px, py) = (py, px)
		par[px] += par[py]
		par[py] = px
		return True
fl = []
for i in range(m):
	(a, b) = map(int, input().split())
	unite(a - 1, b - 1)
	fl.append((a - 1, b - 1))
bl = []
for i in range(k):
	(c, d) = map(int, input().split())
	bl.append((c - 1, d - 1))
points = [0] * n
for i in range(n):
	points[i] = findsize(find(i)) - 1
for i in range(m):
	(a1, b1) = fl[i]
	points[a1] -= 1
	points[b1] -= 1
for i in range(k):
	(c1, d1) = bl[i]
	if find(c1) == find(d1):
		points[c1] -= 1
		points[d1] -= 1
print(*points)


(N, M, K) = map(int, input().split())
adj = [set() for _ in range(N)]
for _ in range(M):
	(A, B) = map(int, input().split())
	(A, B) = (A - 1, B - 1)
	adj[A].add(B)
	adj[B].add(A)
blk = [{*()} for _ in range(N)]
for _ in range(K):
	(A, B) = map(int, input().split())
	(A, B) = (A - 1, B - 1)
	blk[A].add(B)
	blk[B].add(A)
colors = [-1] * N
ct = {}
color = -1
for u in range(N):
	if colors[u] != -1:
		continue
	color += 1
	colors[u] = color
	stk = [u]
	while stk:
		u = stk.pop()
		ct[color] = ct.get(color, 0) + 1
		for v in adj[u]:
			if colors[v] == -1:
				colors[v] = color
				stk.append(v)
ans = [0] * N
for u in range(N):
	c = colors[u]
	k = ct[c] - 1 - len(adj[u])
	for v in blk[u]:
		if colors[v] == c:
			k -= 1
	ans[u] = k
print(*ans)


import sys
sys.setrecursionlimit(10 ** 6)

class UnionFind:

	def __init__(self, n):
		self.par = [i for i in range(n)]

	def root(self, x):
		if self.par[x] == x:
			return x
		else:
			self.par[x] = self.root(self.par[x])
			return self.par[x]

	def unite(self, x, y):
		x = self.root(x)
		y = self.root(y)
		self.par[y] = x

	def same(self, x, y):
		return self.root(x) == self.root(y)
(N, M, K) = map(int, input().split())
uf = UnionFind(N)
fre = [set() for i in range(N)]
for i in range(M):
	(a, b) = map(int, input().split())
	fre[a - 1].add(b - 1)
	fre[b - 1].add(a - 1)
	uf.unite(a - 1, b - 1)
ble = [tuple(map(int, input().split())) for i in range(K)]
ans = [0] * N
t = {}
for n in range(N):
	t[uf.root(n)] = t.get(uf.root(n), 0) + 1
for n in range(N):
	ans[n] = t[uf.root(n)] - len(fre[n]) - 1
for (a, b) in ble:
	if uf.same(a - 1, b - 1):
		ans[a - 1] -= 1
		ans[b - 1] -= 1
print(*ans)


def main():
	(n, m, k) = map(int, input().split())
	ab = [list(map(int, input().split())) for _ in range(m)]
	cd = [list(map(int, input().split())) for _ in range(k)]
	friend = [set() for _ in range(n)]
	block = [set() for _ in range(n)]
	for (a, b) in ab:
		friend[a - 1].add(b - 1)
		friend[b - 1].add(a - 1)
	for (c, d) in cd:
		block[c - 1].add(d - 1)
		block[d - 1].add(c - 1)
	ans = [0] * n
	seen = [0] * n
	for t in range(n):
		if seen[t] == 1:
			continue
		member = set()
		todo = [t]
		seen[t] = 1
		while todo:
			t = todo.pop()
			member.add(t)
			f = friend[t]
			for fi in f:
				if seen[fi] == 0:
					todo.append(fi)
					seen[fi] = 1
		mn = len(member)
		for m in member:
			ans[m] = mn - len(block[m].intersection(member)) - len(friend[m]) - 1
	print(' '.join(map(str, ans)))
main()


import collections, sys
sys.setrecursionlimit(10 ** 9)
(n, m, k) = map(int, input().split())
friend = [[] * (n + 1) for _ in range(n + 1)]
block = [[] * (n + 1) for _ in range(n + 1)]
teams = [0] * (n + 1)
for _ in range(m):
	(a, b) = map(int, input().split())
	friend[a].append(b)
	friend[b].append(a)
for _ in range(k):
	(c, d) = map(int, input().split())
	block[c].append(d)
	block[d].append(c)

def dfs(i):
	teams[i] = team
	for j in friend[i]:
		if teams[j] != 0:
			continue
		dfs(j)
team = 1
for i in range(1, n + 1):
	if teams[i] != 0:
		continue
	dfs(i)
	team += 1
c = collections.Counter(teams)
for i in range(1, n + 1):
	temp = c[teams[i]] - len(friend[i]) - 1
	for j in block[i]:
		if teams[j] == teams[i]:
			temp -= 1
	print(temp, end='')
	if i != n:
		print(' ', end='')


from collections import deque
(N, M, K) = map(int, input().split())
flst = []
blst = []
glooplst = [i for i in range(N + 1)]
colorlst = [0] * (N + 1)
countlst = [0] * (N + 1)
anslst = [0] * (N + 1)
d = deque()
for i in range(N + 1):
	flst.append([])
	blst.append([])
for i in range(M):
	(a, b) = map(int, input().split())
	flst[a].append(b)
	flst[b].append(a)
for i in range(K):
	(a, b) = map(int, input().split())
	blst[a].append(b)
	blst[b].append(a)
for i in range(1, N + 1):
	if colorlst[i] == 0:
		d.append(i)
		colorlst[i] = 1
		countlst[i] += 1
		while d:
			now = d.popleft()
			for j in flst[now]:
				if colorlst[j] == 0:
					d.append(j)
					colorlst[j] = 1
					glooplst[j] = i
					countlst[i] += 1
for i in range(1, N + 1):
	cnt = countlst[glooplst[i]] - len(flst[i]) - 1
	for j in blst[i]:
		if glooplst[i] == glooplst[j]:
			cnt -= 1
	print(cnt, end=' ')
print()


from collections import defaultdict
from collections import Counter
(N, M, K) = map(int, input().split())
fn = defaultdict(lambda : 1)
CD = [0] * K
par = list(range(N))

def root(x):
	S = set()
	S.add(x)
	y = x
	while True:
		if par[y] == y:
			for s in S:
				par[s] = y
			return y
		S.add(y)
		y = par[y]

def unite(x, y):
	rx = root(x)
	ry = root(y)
	par[rx] = ry
for _ in range(M):
	(A, B) = map(int, input().split())
	A -= 1
	B -= 1
	fn[A] += 1
	fn[B] += 1
	unite(A, B)
for _ in range(K):
	(C, D) = map(int, input().split())
	C -= 1
	D -= 1
	CD[_] = (C, D)
par = [root(x) for x in range(N)]
c = Counter(par)
RESULT = [c[par[x]] - fn[x] for x in range(N)]
for (C, D) in CD:
	if par[C] == par[D]:
		RESULT[C] -= 1
		RESULT[D] -= 1
print(*RESULT, sep=' ')


import sys
rl = lambda : next(sys.stdin)
rfs = lambda : rl().split()
ris = lambda : map(int, rfs())
(N, M, K) = ris()
adj = [{*()} for _ in range(N)]
for _ in range(M):
	(A, B) = ris()
	(A, B) = (A - 1, B - 1)
	adj[A].add(B)
	adj[B].add(A)
c = -1
cs = [c] * N
ct = {}
for u in range(N):
	if cs[u] != -1:
		continue
	c += 1
	cs[u] = c
	stk = [u]
	while stk:
		u = stk.pop()
		if c not in ct:
			ct[c] = 0
		ct[c] += 1
		for v in adj[u]:
			if cs[v] != -1:
				continue
			cs[v] = c
			stk.append(v)
ans = [0] * N
for u in range(N):
	g = ct[cs[u]] - 1
	f = len(adj[u])
	ans[u] = g - f
for _ in range(K):
	(A, B) = ris()
	(A, B) = (A - 1, B - 1)
	if cs[A] == cs[B]:
		ans[A] -= 1
		ans[B] -= 1
print(*ans)


from collections import deque
(N, M, K) = map(int, input().split())
friend = [deque([]) for _ in range(N + 1)]
block = [deque([]) for _ in range(N + 1)]
for i in range(M):
	(a, b) = map(int, input().split())
	friend[a].append(b)
	friend[b].append(a)
for i in range(K):
	(c, d) = map(int, input().split())
	block[c].append(d)
	block[d].append(c)
stack = deque()
group = [-1] * (N + 1)
visited = [-1] * (N + 1)
dic = {}
for i in range(1, N + 1):
	stack.append(i)
	main = i
	cnt = 0
	while len(stack) > 0:
		now = stack.popleft()
		if group[now] != -1:
			continue
		stack.extend(friend[now])
		group[now] = main
		cnt += 1
	if cnt != 0:
		dic[main] = cnt
for i in range(1, N + 1):
	ans = dic[group[i]]
	ans -= 1
	ans -= len(friend[i])
	for j in block[i]:
		if group[j] == group[i]:
			ans -= 1
	print(ans)


from collections import deque
(n, m, k) = map(int, input().split())
fri = [[] for _ in range(n + 1)]
blo = [[] for _ in range(n + 1)]
for i in range(m):
	(a, b) = map(int, input().split())
	fri[a].append(b)
	fri[b].append(a)
for i in range(k):
	(a, b) = map(int, input().split())
	blo[a].append(b)
	blo[b].append(a)
gru = [-1] * (n + 1)
gru[0] = 0
visited = [False] * (n + 1)
D = {}
for root in range(1, n + 1):
	if visited[root]:
		continue
	D[root] = set([root])
	d = deque()
	d.append(root)
	while d:
		v = d.popleft()
		visited[v] = True
		gru[v] = root
		for to in fri[v]:
			if visited[to]:
				continue
			D[root].add(to)
			d.append(to)
nans = [0] * n
for i in range(1, n + 1):
	g = D[gru[i]]
	ans = len(g) - len(fri[i]) - 1
	for b in blo[i]:
		if b in g:
			ans -= 1
	nans[i - 1] = ans
print(*nans, sep='\n')


(N, M, K) = map(int, input().split())
parents = [-1] * N
friend = [set() for _ in range(N)]

def find(x):
	if parents[x] < 0:
		return x
	else:
		parents[x] = find(parents[x])
		return parents[x]

def union(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return
	if parents[x] > parents[y]:
		(x, y) = (y, x)
	parents[x] += parents[y]
	parents[y] = x
for _ in range(M):
	(A, B) = map(int, input().split())
	union(A - 1, B - 1)
	friend[A - 1].add(B - 1)
	friend[B - 1].add(A - 1)
a = [-parents[find(i)] - len(friend[i]) - 1 for i in range(N)]
for _ in range(K):
	(C, D) = map(int, input().split())
	if find(C - 1) == find(D - 1):
		a[C - 1] -= 1
		a[D - 1] -= 1
print(*a)


import sys
sys.setrecursionlimit(10 ** 9)
(n, m, k) = map(int, input().split())
ab = [[] for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	ab[a].append(b)
	ab[b].append(a)
block = [set() for i in range(n)]
for i in range(k):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	block[c].add(d)
	block[d].add(c)
ans = [0 for i in range(n)]

def dfs(s):
	if vis[s] == False:
		vis[s] = True
		r[cnt].add(s)
		for i in ab[s]:
			dfs(i)
vis = [False for i in range(n)]
r = []
cnt = 0
for i in range(n):
	if vis[i] == False:
		r.append(set())
		dfs(i)
		cnt += 1
ans = [0 for i in range(n)]
for i in r:
	l = len(i)
	for j in i:
		ans[j] = l - len(ab[j]) - len(i & block[j]) - 1
print(*ans)


def find_parent(x):
	y = parent[x]
	if y < 0:
		return x
	parent[x] = find_parent(y)
	return parent[x]

def connect(a, b):
	c = find_parent(a)
	d = find_parent(b)
	if c == d:
		return
	if parent[c] < parent[d]:
		parent[c] += parent[d]
		parent[d] = c
	else:
		parent[d] += parent[c]
		parent[c] = d
	return
(N, M, K) = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(M)]
CD = [list(map(int, input().split())) for i in range(K)]
parent = [-1] * (N + 1)
for (A, B) in AB:
	connect(A, B)
ans = [0] * (N + 1)
for i in range(1, N + 1):
	ans[i] = -parent[find_parent(i)] - 1
for (A, B) in AB:
	ans[A] -= 1
	ans[B] -= 1
for (C, D) in CD:
	if find_parent(C) == find_parent(D):
		ans[C] -= 1
		ans[D] -= 1
print(*ans[1:])


(n, m, k) = map(int, input().split())
par = [-1 for i in range(n)]

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def size(x):
	return -par[find(x)]

def unite(x, y):
	(x, y) = (find(x), find(y))
	if x == y:
		return
	if x > y:
		(x, y) = (y, x)
	par[x] += par[y]
	par[y] = x

def same(x, y):
	return find(x) == find(y)
ans = [-1 for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	unite(a - 1, b - 1)
	ans[a - 1] -= 1
	ans[b - 1] -= 1
for i in range(k):
	(a, b) = map(int, input().split())
	if same(a - 1, b - 1):
		ans[a - 1] -= 1
		ans[b - 1] -= 1
for i in range(n):
	ans[i] += size(i)
print(*ans)


(n, m, k) = map(int, input().split())
f = [[] for _ in range(n)]
g = [[] for _ in range(n)]
for _ in range(m):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	f[a].append(b)
	f[b].append(a)
for _ in range(k):
	(c, d) = map(int, input().split())
	(c, d) = (c - 1, d - 1)
	g[c].append(d)
	g[d].append(c)
d = {}
parent = [-1] * n
seen = [False] * n
from collections import deque
for i in range(n):
	if seen[i]:
		continue
	stack = deque()
	d[i] = set([i])
	stack = [i]
	while stack:
		v = stack.pop()
		seen[v] = True
		parent[v] = i
		for nv in f[v]:
			if seen[nv]:
				continue
			d[i].add(nv)
			stack.append(nv)
ans = [0] * n
for i in range(n):
	group = d[parent[i]]
	sum = len(group) - len(f[i]) - len(set(g[i]) & group) - 1
	ans[i] = sum
print(*ans)


import sys
sys.setrecursionlimit(10000000)
(n, m, k) = map(int, input().split())
stock = [[] for i in range(n)]
ter = [0] * n
ans = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	stock[a - 1].append(b - 1)
	stock[b - 1].append(a - 1)
	ans[a - 1] -= 1
	ans[b - 1] -= 1

def dfs(j, k):
	size[k] += 1
	for next_j in stock[j]:
		if ter[next_j] == 0:
			ter[next_j] = k
			dfs(next_j, k)
total = 0
size = [0] * (n + 1)
for i in range(n):
	if ter[i] == 0:
		total += 1
		ter[i] = total
		dfs(i, total)
for i in range(n):
	ans[i] += size[ter[i]] - 1
for i in range(k):
	(c, d) = map(int, input().split())
	if ter[c - 1] == ter[d - 1]:
		ans[c - 1] -= 1
		ans[d - 1] -= 1
for i in range(n - 1):
	print(ans[i], end=' ')
print(ans[n - 1])


INT = lambda : int(input())
INTM = lambda : map(int, input().split())
STRM = lambda : map(str, input().split())
STR = lambda : str(input())
LIST = lambda : list(map(int, input().split()))
LISTS = lambda : list(map(str, input().split()))

class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join(('{}: {}'.format(r, self.members(r)) for r in self.roots()))

def do():
	(n, m, k) = INTM()
	uf = UnionFind(n)
	fri = [[] for i in range(n)]
	blo = [[] for i in range(n)]
	for i in range(m):
		(a, b) = INTM()
		a -= 1
		b -= 1
		fri[a].append(b)
		fri[b].append(a)
		uf.union(a, b)
	for i in range(k):
		(c, d) = INTM()
		c -= 1
		d -= 1
		blo[c].append(d)
		blo[d].append(c)
	ans = []
	for i in range(n):
		blos = 0
		for j in blo[i]:
			if uf.same(i, j):
				blos += 1
		ans.append(uf.size(i) - 1 - len(fri[i]) - blos)
	print(*ans)

def __starting_point():
	do()
__starting_point()


from sys import setrecursionlimit
setrecursionlimit(2 * 10 ** 9)
(n, m, k) = map(int, input().split())

def dfs(u):
	if visited[u]:
		return
	visited[u] = True
	for v in graph[u]:
		s.add(v)
		dfs(v)
graph = {i: set() for i in range(n)}
blocks = {i: set() for i in range(n)}
for _ in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	graph[a].add(b)
	graph[b].add(a)
for _ in range(k):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	blocks[c].add(d)
	blocks[d].add(c)
ans = [0] * n
visited = [False] * n
for u in range(n):
	if not visited[u]:
		s = set()
		dfs(u)
		l = len(s)
		for i in s:
			ans[i] += l - 1
			ans[i] -= len(blocks[i].intersection(s))
			ans[i] -= len(graph[i].intersection(s))
print(*ans)


import sys
ris = lambda : map(int, next(sys.stdin).split())
(N, M, K) = ris()
adj = [set() for _ in range(N)]
for _ in range(M):
	(A, B) = ris()
	(A, B) = (A - 1, B - 1)
	adj[A].add(B)
	adj[B].add(A)
colors = [-1] * N
ct = {}
color = -1
for u in range(N):
	if colors[u] != -1:
		continue
	color += 1
	colors[u] = color
	stk = [u]
	while stk:
		u = stk.pop()
		ct[color] = ct.get(color, 0) + 1
		for v in adj[u]:
			if colors[v] == -1:
				colors[v] = color
				stk.append(v)
blk = [{*()} for _ in range(N)]
for _ in range(K):
	(A, B) = ris()
	(A, B) = (A - 1, B - 1)
	if colors[A] == colors[B]:
		blk[A].add(B)
		blk[B].add(A)
ans = [0] * N
for u in range(N):
	c = colors[u]
	g = len(adj[u])
	b = len(blk[u])
	k = ct[c] - 1 - g - b
	ans[u] = k
print(*ans)


(n, m, k) = map(int, input().split())
A = [[] for i in range(n + 1)]
for i in range(m):
	(a, b) = map(int, input().split())
	A[a].append(b)
	A[b].append(a)
C = [[] for i in range(n + 1)]
for i in range(k):
	(c, d) = map(int, input().split())
	C[c].append(d)
	C[d].append(c)
from collections import deque
reach = [0] * (n + 1)
for i in range(1, n + 1):
	if reach[i] != 0:
		pass
	else:
		reach[i] = i
		q = deque([])
		q.append(i)
		while q:
			x = q.popleft()
			for s in A[x]:
				if reach[s] == 0:
					q.append(s)
					reach[s] = i
dis_count = [0] * (n + 1)
for (i, C0) in enumerate(C):
	for CC in C0:
		if reach[CC] == reach[i]:
			dis_count[i] += 1
import collections
D = collections.Counter(reach)
for i in range(1, n + 1):
	print(D[reach[i]] - len(A[i]) - dis_count[i] - 1, end='')
	print(' ', end='')
print('')


from collections import Counter
import sys
(n, m, k) = map(int, input().split())
F = [[] for _ in range(n)]
B = [[0] for _ in range(n)]
sys.setrecursionlimit(10 ** 9)
for _ in range(m):
	(a, b) = map(int, input().split())
	F[a - 1].append(b)
	F[b - 1].append(a)
rks = [0] * n

def dfs(s, r):
	if rks[s] == 0:
		rks[s] = r
	for i in F[s]:
		if rks[i - 1] != 0:
			continue
		dfs(i - 1, r)
r = 0
for i in range(n):
	if rks[i] == 0:
		r += 1
		dfs(i, r)
for _ in range(k):
	(c, d) = map(int, input().split())
	if rks[c - 1] == rks[d - 1]:
		B[c - 1][0] += 1
		B[d - 1][0] += 1
counter = Counter(rks)
for i in range(n):
	print(counter[rks[i]] - len(F[i]) - B[i][0] - 1)


class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)
(N, M, K) = map(int, input().split())
uf = UnionFind(N)
lst = [0] * N
ans = [0] * N
for i in range(M):
	(A, B) = map(int, input().split())
	uf.union(A - 1, B - 1)
	lst[A - 1] += 1
	lst[B - 1] += 1
for i in range(K):
	(A, B) = map(int, input().split())
	if uf.same(A - 1, B - 1):
		lst[A - 1] += 1
		lst[B - 1] += 1
for i in range(N):
	ans[i] = uf.size(i) - lst[i] - 1
L = [str(a) for a in ans]
L = ' '.join(L)
print(L)


(n, m, k) = map(int, input().split())
peer = [[] for _ in range(n)]
num = [1 for _ in range(n)]
for _ in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	num[a] += 1
	num[b] += 1
	peer[a].append(b)
	peer[b].append(a)
seen = [0 for _ in range(n)]
root = [i for i in range(n)]
cnt = [0 for _ in range(n)]
for i in range(n):
	if seen[i] == 1:
		continue
	seen[i] = 1
	now = [i]
	tmp = 1
	while now:
		last = now
		now = []
		for x in last:
			for y in peer[x]:
				if seen[y] == 0:
					seen[y] = 1
					now.append(y)
					root[y] = i
					tmp += 1
	cnt[i] = tmp
for i in range(n):
	cnt[i] = cnt[root[i]]
for i in range(n):
	cnt[i] -= num[i]
for _ in range(k):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	if root[a] == root[b]:
		cnt[a] -= 1
		cnt[b] -= 1
print(' '.join(map(str, cnt)))


from collections import deque
(N, M, K) = map(int, input().split())
G = [[] for i in range(N)]
NG = [set() for i in range(N)]
for _ in range(M):
	(A, B) = map(int, input().split())
	G[A - 1].append(B - 1)
	G[B - 1].append(A - 1)
	NG[A - 1].add(B - 1)
	NG[B - 1].add(A - 1)
for _ in range(K):
	(A, B) = map(int, input().split())
	NG[A - 1].add(B - 1)
	NG[B - 1].add(A - 1)
C = [-1] * N
CNT = [0] * N
c = 0
for i in range(N):
	if C[i] >= 0:
		continue
	Q = [i]
	C[i] = c
	CNT[c] += 1
	while Q:
		x = Q.pop()
		for y in G[x]:
			if C[y] == -1:
				C[y] = C[x]
				CNT[C[y]] += 1
				Q.append(y)
	c += 1
Y = [0] * N
for i in range(N):
	Y[i] = CNT[C[i]] - 1
for i in range(N):
	for j in NG[i]:
		if C[i] == C[j]:
			Y[i] -= 1
print(*Y)


import sys
from collections import Counter
(N, M, K) = map(int, input().split())
f = [[] for _ in range(N + 1)]
b = [[] for _ in range(N + 1)]
for i in range(M):
	(x, y) = map(int, input().split())
	f[x].append(y)
	f[y].append(x)
d = [None] * (N + 1)
sys.setrecursionlimit(10 ** 9)

def dfs(f, s, id):
	if d[s] is None:
		d[s] = id
	for i in f[s]:
		if d[i] is not None:
			continue
		dfs(f, i, id)
cnt = -1
for j in range(1, N + 1):
	if d[j] == None:
		cnt += 1
		dfs(f, j, cnt)
for i in range(K):
	(x, y) = map(int, input().split())
	if d[x] == d[y]:
		b[x].append(y)
		b[y].append(x)
c = Counter(d)
for i in range(1, N + 1):
	print(c[d[i]] - len(f[i]) - len(b[i]) - 1)


(N, M, K) = map(int, input().split())
par = [i for i in range(N)]
rank = [0] * N
friend = [0] * N
block = [0] * N
size = [1] * N

def find(x):
	if par[x] == x:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def same(x, y):
	return find(x) == find(y)

def union(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return
	if rank[x] > rank[y]:
		par[y] = x
		size[x] += size[y]
	else:
		par[x] = y
		size[y] += size[x]
		if rank[x] == rank[y]:
			rank[y] += 1
for i in range(M):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	union(a, b)
	friend[a] += 1
	friend[b] += 1
for i in range(K):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	if same(c, d):
		block[c] += 1
		block[d] += 1
ans = []
for i in range(N):
	ans.append(size[find(i)] - friend[i] - block[i] - 1)
print(*ans)


from collections import deque
(N, M, K) = map(int, input().split())
friend = [list(map(int, input().split())) for _ in range(M)]
block = [list(map(int, input().split())) for _ in range(K)]
f = [set() for _ in range(N + 1)]
b = [set() for _ in range(N + 1)]
for (i, j) in friend:
	f[i].add(j)
	f[j].add(i)
for (i, j) in block:
	b[i].add(j)
	b[j].add(i)
stack = deque()
linkList = []
ans = [0] * (N + 1)
visited = [0] * (N + 1)
for i in range(1, N + 1):
	if visited[i]:
		continue
	link = {i}
	visited[i] = 1
	stack.append(i)
	while stack:
		n = stack.pop()
		for j in f[n]:
			if j in f[n] and visited[j] == 0:
				stack.append(j)
				visited[j] = 1
				link.add(j)
	linkList.append(link)
	for i in link:
		ans[i] = len(link) - len(link & f[i]) - len(link & b[i]) - 1
print(*ans[1:])


(N, M, K) = map(int, input().split())
par = [i for i in range(N)]
siz = [1 for _ in range(N)]
rank = [0 for _ in range(N)]

def find(x):
	if par[x] == x:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def union(a, b):
	a = find(a)
	b = find(b)
	if a == b:
		return 0
	elif rank[a] > rank[b]:
		par[b] = a
		siz[a] += siz[b]
	else:
		par[a] = b
		siz[b] += siz[a]
		if rank[a] == rank[b]:
			rank[b] += 1

def size(a):
	return siz[find(a)]

def same(a, b):
	return find(a) == find(b)
ans = [0 for i in range(N)]
for _ in range(M):
	(A, B) = map(int, input().split())
	(A, B) = (A - 1, B - 1)
	union(A, B)
	ans[A] -= 1
	ans[B] -= 1
for i in range(N):
	ans[i] += size(i) - 1
for _ in range(K):
	(C, D) = map(int, input().split())
	(C, D) = (C - 1, D - 1)
	if same(C, D):
		ans[C] -= 1
		ans[D] -= 1
print(*ans)


from collections import deque
(N, M, K) = map(int, input().split())
A = [[] for i in range(N)]
B = [[] for i in range(N)]
for i in range(M):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	A[a].append(b)
	A[b].append(a)
for i in range(K):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	B[a].append(b)
	B[b].append(a)
P = [-1 for i in range(N)]
Q = []
k = -1
for i in range(N):
	if P[i] == -1:
		q = 1
		k += 1
		P[i] = k
		d = deque([i])
		while len(d):
			s = d.pop()
			for t in A[s]:
				if P[t] == -1:
					P[t] = k
					q += 1
					d.append(t)
		Q.append(q)
for i in range(N):
	ans = Q[P[i]] - len(A[i]) - 1
	for j in B[i]:
		if P[i] == P[j]:
			ans -= 1
	print(ans)


import sys
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
graph = {i + 1: [] for i in range(n)}
block = {i + 1: [] for i in range(n)}
ans = [-1 for _ in range(n)]
for _ in range(m):
	(a, b) = map(int, input().split())
	graph[a].append(b)
	graph[b].append(a)
for _ in range(k):
	(c, d) = map(int, input().split())
	block[c].append(d)
	block[d].append(c)
from collections import deque
for i in range(1, n + 1):
	if ans[i - 1] != -1:
		continue
	queue = deque([i])
	friends = set([i])
	while queue:
		node = queue.popleft()
		for n in graph[node]:
			block[node].append(n)
			if n in friends:
				continue
			friends.add(n)
			queue.append(n)
	for n in friends:
		ans[n - 1] = len(friends) - 1
		for b in set(block[n]):
			if b in friends:
				ans[n - 1] -= 1
print(*ans)


(N, M, K) = map(int, input().split())
uf = [-1 for _ in range(N)]
fc = [0] * N
bc = [0] * N
ans = [0] * N

def find(x):
	if uf[x] < 0:
		return x
	uf[x] = find(uf[x])
	return uf[x]

def unite(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return
	if x < y:
		(x, y) = (y, x)
	uf[y] += uf[x]
	uf[x] = y
for m in range(M):
	(a, b) = map(int, input().split())
	fc[a - 1] += 1
	fc[b - 1] += 1
	unite(a - 1, b - 1)
for k in range(K):
	(c, d) = map(int, input().split())
	if find(c - 1) == find(d - 1):
		bc[c - 1] += 1
		bc[d - 1] += 1
for i in range(N):
	cnt = -uf[find(i)] - 1 - fc[i] - bc[i]
	ans[i] = cnt
print(*ans)


import sys
sys.setrecursionlimit(10 ** 9)
(N, M, K) = map(int, input().split())
Friend = [[] for i in range(N)]
for _ in range(M):
	(A, B) = map(int, input().split())
	Friend[A - 1].append(B - 1)
	Friend[B - 1].append(A - 1)
Block = [set() for i in range(N)]
for _ in range(K):
	(C, D) = map(int, input().split())
	Block[C - 1].add(D - 1)
	Block[D - 1].add(C - 1)

def dfs(x):
	if seen[x] == 0:
		R[cnt].add(x)
		seen[x] = 1
		for i in Friend[x]:
			dfs(i)
seen = [0] * N
cnt = 0
R = []
for i in range(N):
	if seen[i] == 0:
		R.append(set())
		dfs(i)
		cnt += 1
seq = [0] * N
for r in R:
	lr = len(r)
	for j in r:
		seq[j] = lr - len(Friend[j]) - len(r & Block[j]) - 1
print(*seq)


class UnionFind:

	def __init__(self, n: int) -> None:
		self.forest = [-1] * n

	def union(self, x: int, y: int) -> None:
		x = self.findRoot(x)
		y = self.findRoot(y)
		if x == y:
			return
		if self.forest[x] > self.forest[y]:
			(x, y) = (y, x)
		self.forest[x] += self.forest[y]
		self.forest[y] = x
		return

	def findRoot(self, x: int) -> int:
		if self.forest[x] < 0:
			return x
		else:
			self.forest[x] = self.findRoot(self.forest[x])
			return self.forest[x]

	def issame(self, x: int, y: int) -> bool:
		return self.findRoot(x) == self.findRoot(y)

	def size(self, x: int) -> int:
		return -self.forest[self.findRoot(x)]
(n, m, k) = map(int, input().split())
l = [[] for _ in range(n)]
u = UnionFind(n)
for _ in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	u.union(a, b)
	l[a].append(b)
	l[b].append(a)
for _ in range(k):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	if u.issame(c, d):
		l[c].append(d)
		l[d].append(c)
for i in range(n):
	q = u.size(i)
	w = len(l[i])
	print(q - w - 1, end=' ')


def find(i):
	x = i
	while x != G[x][0]:
		x = G[x][0]
	return x

def union(i, j):
	ai = find(i)
	ni = G[ai][1]
	aj = find(j)
	nj = G[aj][1]
	if ai != aj:
		if ni >= nj:
			G[aj][0] = ai
			if G[aj][1] == G[ai][1]:
				G[ai][1] += 1
			G[ai][2] += G[aj][2]
		else:
			G[ai][0] = aj
			G[aj][2] += G[ai][2]
(N, M, K) = map(int, input().split())
G = {i: [i, 0, 1] for i in range(1, N + 1)}
A = {i: [] for i in range(1, N + 1)}
B = {i: [] for i in range(1, N + 1)}
for _ in range(M):
	(a, b) = map(int, input().split())
	union(a, b)
	A[a].append(b)
	A[b].append(a)
for _ in range(K):
	(c, d) = map(int, input().split())
	B[c].append(d)
	B[d].append(c)
C = []
for i in range(1, N + 1):
	ai = find(i)
	n = G[ai][2]
	m = len(A[i])
	k = 0
	for j in B[i]:
		if ai == find(j):
			k += 1
	n = n - m - k
	C.append(n - 1)
print(*C)


from collections import deque
(n, m, k) = map(int, input().split())
friend = [set() for _ in range(n)]
block = [set() for _ in range(n)]
for _ in range(m):
	(a, b) = map(int, input().split())
	friend[a - 1].add(b - 1)
	friend[b - 1].add(a - 1)
for _ in range(k):
	(a, b) = map(int, input().split())
	block[a - 1].add(b - 1)
	block[b - 1].add(a - 1)
visited = [0 for _ in range(n)]
ans = [None for _ in range(n)]
for i in range(n):
	if visited[i]:
		continue
	prefriends = {i}
	check = deque([i])
	while check:
		now = check.pop()
		visited[now] = 1
		for next in friend[now]:
			if visited[next] == 0:
				check.append(next)
				prefriends.add(next)
	for j in prefriends:
		ans[j] = len(prefriends) - 1 - len(friend[j]) - len(prefriends & block[j])
print(' '.join(list(map(str, ans))))


(n, m, k) = list(map(int, input().split()))
f_adj_list = [[] for i in range(n)]
b_adj_list = [[] for i in range(n)]
for i in range(m):
	(_, __) = list(map(int, input().split()))
	_ -= 1
	__ -= 1
	f_adj_list[_].append(__)
	f_adj_list[__].append(_)
for j in range(k):
	(_, __) = list(map(int, input().split()))
	_ -= 1
	__ -= 1
	b_adj_list[_].append(__)
	b_adj_list[__].append(_)
group_id = [None for i in range(n)]
for i in range(n):
	if group_id[i] is not None:
		continue
	newly_visited = [i]
	group_id[i] = i
	while len(newly_visited) > 0:
		now = newly_visited.pop()
		for j in f_adj_list[now]:
			if group_id[j] is not None:
				continue
			newly_visited.append(j)
			group_id[j] = i
from collections import Counter
cnt = Counter(group_id)
ans_list = []
for i in range(n):
	ans = cnt[group_id[i]]
	ans -= 1
	ans -= len(f_adj_list[i])
	for j in b_adj_list[i]:
		if group_id[i] == group_id[j]:
			ans -= 1
	ans_list.append(ans)
print(' '.join(map(str, ans_list)))


from collections import deque
(n, m, k) = map(int, input().split())
fr = [[]]
for i in range(n - 1):
	fr.append([])
for i in range(m):
	(a, b) = map(int, input().split())
	fr[a - 1].append(b)
	fr[b - 1].append(a)
belong = [0] * n
anslist = [0] * n
count = 0

def bfs(k):
	global count
	if belong[k - 1] == 0:
		count += 1
		use = deque()
		use.append(k)
		ans = 0
		aldic = {}
		while use:
			check = use.popleft()
			if check not in aldic:
				aldic[check] = 1
				for x in fr[check - 1]:
					use.append(x)
		for x in aldic:
			belong[x - 1] = count
			anslist[x - 1] = len(aldic) - len(fr[x - 1]) - 1
for i in range(1, n + 1):
	bfs(i)
for i in range(k):
	(a, b) = map(int, input().split())
	if belong[a - 1] == belong[b - 1]:
		anslist[a - 1] -= 1
		anslist[b - 1] -= 1
for i in range(0, len(anslist)):
	if i != len(anslist) - 1:
		print(anslist[i], end=' ')
	else:
		print(anslist[i])


(n, m, k) = map(int, input().split())
par = [-1] * (n + 1)

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def same(x, y):
	return find(x) == find(y)

def unite(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return 0
	else:
		if par[x] > par[y]:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x

def size(x):
	return -par[find(x)]
g = [[] for _ in range(n + 1)]
b = [[] for _ in range(n + 1)]
for _ in range(m):
	(s, t) = map(int, input().split())
	unite(s, t)
	g[s].append(t)
	g[t].append(s)
for _ in range(k):
	(s, t) = map(int, input().split())
	b[s].append(t)
	b[t].append(s)
for i in range(1, n + 1):
	ans = size(i) - 1 - len(g[i])
	for e in b[i]:
		if same(i, e):
			ans -= 1
	print(ans, end=' ')


from collections import deque
(N, M, K) = map(int, input().split())
F = [[] for _ in range(N)]
B = [[] for _ in range(N)]
for i in range(M):
	(a, b) = map(int, input().split())
	F[a - 1].append(b - 1)
	F[b - 1].append(a - 1)
for i in range(K):
	(a, b) = map(int, input().split())
	B[a - 1].append(b - 1)
	B[b - 1].append(a - 1)
q = deque([])
G = []
visited = [0] * N
group = [-1] * N
idx = 0
for i in range(N):
	if visited[i] == 1:
		continue
	visited[i] = 1
	group[i] = idx
	q.append([i, [i]])
	while q:
		(n, c) = q.pop()
		for j in F[n]:
			if visited[j] == 0:
				c.append(j)
				visited[j] = 1
				group[j] = idx
				q.append([j, c])
	G.append(c)
	idx += 1
cnt = [0] * N
for g in G:
	for i in g:
		for b in B[i]:
			if group[i] == group[b]:
				cnt[i] += 1
ans = [0] * N
for g in G:
	for i in g:
		ans[i] = len(g) - len(F[i]) - cnt[i] - 1
for i in ans:
	print(str(i), end=' ')


(n, m, k) = map(int, input().split())
BAD = [0 for i in range(n + 1)]
E = []
for inp in range(m):
	(a, b) = map(int, input().split())
	E.append((a, b))
	BAD[a] -= 1
	BAD[b] -= 1
B = []
for inp in range(k):
	(a, b) = map(int, input().split())
	B.append((a, b))
uf = [i for i in range(n + 1)]

def uf_find(x, uf=uf):
	while uf[x] != x:
		x = uf[x]
	return x
res = []
for ele in E:
	if uf_find(ele[0]) == uf_find(ele[1]):
		continue
	else:
		res.append((ele[0], ele[1]))
		if uf_find(ele[0]) > uf_find(ele[1]):
			uf[uf_find(ele[0])] = uf_find(ele[1])
		else:
			uf[uf_find(ele[1])] = uf_find(ele[0])
SCO = [0 for i in range(n + 1)]
for i in range(1, n + 1):
	SCO[uf_find(i)] += 1
for bl in B:
	if uf_find(bl[0]) == uf_find(bl[1]):
		BAD[bl[0]] -= 1
		BAD[bl[1]] -= 1
ANS = [str(SCO[uf_find(i)] + BAD[i] - 1) for i in range(1, n + 1)]
print(' '.join(ANS))


import sys
from collections import defaultdict
sys.setrecursionlimit(10 ** 6)
(n, m, k) = map(int, input().split())
friend = [[] for _ in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	friend[a - 1].append(b - 1)
	friend[b - 1].append(a - 1)
par = [None] * n
frmember = defaultdict(int)

def dfs(v):
	if par[i] == None:
		par[v] = v
		frmember[par[v]] += 1
	for f in friend[v]:
		if par[f] == None:
			par[f] = par[v]
			frmember[par[v]] += 1
			dfs(f)
for i in range(n):
	if par[i] == None:
		dfs(i)
ans = [0] * n
for i in range(n):
	ans[i] += frmember[par[i]] - len(friend[i]) - 1
for i in range(k):
	(a, b) = map(int, input().split())
	if par[a - 1] == par[b - 1]:
		ans[a - 1] -= 1
		ans[b - 1] -= 1
print(*ans)


import time, sys
sys.setrecursionlimit(int(10000000.0))
(n, m, k) = map(int, input().split())
friends = [[] for i in range(n)]
cands = [None for i in range(n)]
cycles = []
visited = [False for i in range(n)]
count = [0 for i in range(n)]
for _ in range(m):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	friends[a].append(b)
	friends[b].append(a)

def dfs(x):
	visited[x] = True
	cycle.add(x)
	for i in friends[x]:
		if not visited[i]:
			dfs(i)
	return
for (i, v) in enumerate(visited):
	if v:
		continue
	cycle = set()
	dfs(i)
	l = len(cycle)
	ind = len(cycles)
	cycles.append(cycle)
	for fr in cycle:
		cands[fr] = ind
		count[fr] = l - 1 - len(friends[fr])
for _ in range(k):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	if a in cycles[cands[b]]:
		count[a] -= 1
		count[b] -= 1
for i in count:
	print(i, end=' ')


(N, M, K) = list(map(int, input().split()))

class UnionFind:

	def __init__(self, n):
		self.n = n
		self.par = [i for i in range(n)]
		self.size = [1 for i in range(n)]

	def find(self, x):
		if self.par[x] != x:
			self.par[x] = self.find(self.par[x])
		return self.par[x]

	def unite(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.size[x] > self.size[y]:
			(x, y) = (y, x)
		self.par[x] = y
		self.size[y] += self.size[x]
uf = UnionFind(N)
fri = []
rst = [0] * N
for m in range(M):
	(A, B) = list(map(int, input().split()))
	A -= 1
	B -= 1
	fri.append((A, B))
	uf.unite(A, B)
for i in range(N):
	ind = uf.find(i)
	rst[i] = uf.size[ind] - 1
for f in fri:
	(A, B) = f
	if uf.par[A] == uf.par[B]:
		rst[A] -= 1
		rst[B] -= 1
for k in range(K):
	(C, D) = list(map(int, input().split()))
	C -= 1
	D -= 1
	if uf.par[C] == uf.par[D]:
		rst[C] -= 1
		rst[D] -= 1
print(' '.join(map(str, rst)))


class Uf:

	def __init__(self, N):
		self.p = list(range(N))
		self.rank = [0] * N
		self.size = [1] * N

	def root(self, x):
		if self.p[x] != x:
			self.p[x] = self.root(self.p[x])
		return self.p[x]

	def same(self, x, y):
		return self.root(x) == self.root(y)

	def unite(self, x, y):
		u = self.root(x)
		v = self.root(y)
		if u == v:
			return
		if self.rank[u] < self.rank[v]:
			self.p[u] = v
			self.size[v] += self.size[u]
			self.size[u] = 0
		else:
			self.p[v] = u
			self.size[u] += self.size[v]
			self.size[v] = 0
			if self.rank[u] == self.rank[v]:
				self.rank[u] += 1

	def count(self, x):
		return self.size[self.root(x)]
(N, M, K) = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
CD = [list(map(int, input().split())) for _ in range(K)]
uf = Uf(N + 1)
M = [-1] * (N + 1)
for (a, b) in AB:
	uf.unite(a, b)
	M[a] -= 1
	M[b] -= 1
for (c, d) in CD:
	if uf.same(c, d):
		M[c] -= 1
		M[d] -= 1
for i in range(1, N + 1):
	M[i] += uf.count(i)
print(' '.join(map(str, M[1:])))


import sys
input = sys.stdin.readline

def main():
	(n, m, k) = map(int, input().split())
	ab = [list(map(int, input().split())) for _ in range(m)]
	cd = [list(map(int, input().split())) for _ in range(k)]
	gf = [[] for _ in range(n)]
	for (a, b) in ab:
		gf[a - 1].append(b - 1)
		gf[b - 1].append(a - 1)
	gb = [[] for _ in range(n)]
	for (c, d) in cd:
		gb[c - 1].append(d - 1)
		gb[d - 1].append(c - 1)
	seen = [0] * n
	ans = [0] * n
	for i in range(n):
		c = set([i])
		if seen[i] == 0:
			todo = [i]
			while todo:
				e = todo.pop()
				l = gf[e]
				for li in l:
					if seen[li] == 0:
						todo.append(li)
						seen[li] = 1
						c.add(li)
			base = len(c) - 1
			for ci in c:
				ans[ci] = base
				for fb in gb[ci] + gf[ci]:
					if fb in c:
						ans[ci] -= 1
	print(' '.join(map(str, ans)))
main()


def root(x):
	while par[x] >= 0:
		x = par[x]
	return x

def unite(x, y):
	(x, y) = (root(x), root(y))
	if x != y:
		if x > y:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x

def same(x, y):
	return root(x) == root(y)

def size(x):
	return -par[root(x)]
(n, m, k, *t) = map(int, open(0).read().split())
par = [-1] * n
f = [set() for _ in range(n)]
for (a, b) in zip(*[iter(t[:m * 2])] * 2):
	a -= 1
	b -= 1
	unite(a, b)
	f[a].add(b)
	f[b].add(a)
a = [size(i) - len(f[i]) - 1 for i in range(n)]
for (c, d) in zip(*[iter(t[m * 2:])] * 2):
	c -= 1
	d -= 1
	if same(c, d):
		a[c] -= 1
		a[d] -= 1
print(*a)


class UnionFind:

	def __init__(self, N):
		self.parents = [-1] * N

	def root(self, x):
		if self.parents[x] < 0:
			return x
		else:
			return self.root(self.parents[x])

	def unite(self, x, y):
		(x, y) = (self.root(x), self.root(y))
		if x == y:
			return
		else:
			if x > y:
				(x, y) = (y, x)
			self.parents[x] += self.parents[y]
			self.parents[y] = x
			return
(N, M, K) = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
CD = [list(map(int, input().split())) for _ in range(K)]
u = UnionFind(N)
f = [set() for _ in range(N)]
l = [set() for _ in range(N)]
for (a, b) in AB:
	(a, b) = (a - 1, b - 1)
	f[a].add(b)
	f[b].add(a)
	u.unite(a, b)
for (c, d) in CD:
	(c, d) = (c - 1, d - 1)
	l[c].add(d)
	l[d].add(c)
ans = [0] * N
for i in range(N):
	r = u.root(i)
	bl = 0
	for j in l[i]:
		if u.root(j) == r:
			bl += 1
	ans[i] = -u.parents[r] - len(f[i]) - bl - 1
print(' '.join(list(map(str, ans))))


import sys
from collections import Counter as cc

def input():
	return sys.stdin.readline().rstrip()

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

class UnionFind:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.height = [0] * n

	def get_root(self, i):
		if self.parent[i] == i:
			return i
		else:
			self.parent[i] = self.get_root(self.parent[i])
			return self.parent[i]

	def unite(self, i, j):
		root_i = self.get_root(i)
		root_j = self.get_root(j)
		if root_i != root_j:
			if self.height[root_i] < self.height[root_j]:
				self.parent[root_i] = root_j
			else:
				self.parent[root_j] = root_i
				if self.height[root_i] == self.height[root_j]:
					self.height[root_i] += 1

	def is_in_group(self, i, j):
		if self.get_root(i) == self.get_root(j):
			return True
		else:
			return False

def main():
	(n, m, k) = mi()
	e = [0] * n
	uf = UnionFind(n)
	for i in range(m):
		(a, b) = mi()
		a -= 1
		b -= 1
		e[a] -= 1
		e[b] -= 1
		uf.unite(a, b)
	for _ in range(k):
		(a, b) = mi()
		a -= 1
		b -= 1
		if uf.is_in_group(a, b):
			e[a] -= 1
			e[b] -= 1
	for i in range(n):
		uf.get_root(i)
	s = cc(uf.parent)
	for i in range(n):
		x = uf.get_root(i)
		e[i] += s[x] - 1
	print(*e)

def __starting_point():
	main()
__starting_point()


f = lambda : map(int, input().split())
(n, m, k) = f()
p = [-1] * n

def root(x):
	while p[x] >= 0:
		x = p[x]
	return x

def unite(x, y):
	(x, y) = (root(x), root(y))
	if x == y:
		return
	if x > y:
		(x, y) = (y, x)
	p[x] += p[y]
	p[y] = x

def same(x, y):
	return root(x) == root(y)

def size(x):
	return -p[root(x)]
l = [-1] * n
for _ in range(m):
	(a, b) = f()
	unite(a - 1, b - 1)
	l[a - 1] -= 1
	l[b - 1] -= 1
for i in range(n):
	l[i] += size(i)
for _ in range(k):
	(c, d) = f()
	if same(c - 1, d - 1):
		l[c - 1] -= 1
		l[d - 1] -= 1
print(*l)


(N, M, K) = map(int, input().split())
friend = [[] for _ in range(N)]
block = [[] for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split())
	friend[a - 1].append(b - 1)
	friend[b - 1].append(a - 1)
for _ in range(K):
	(a, b) = map(int, input().split())
	block[a - 1].append(b - 1)
	block[b - 1].append(a - 1)
vst = [0] * N
SIZE = []
C = 0
for i in range(N):
	if not vst[i]:
		C += 1
		vst[i] = C
		q = [i]
		cnt = 0
		for u in q:
			cnt += 1
			for v in friend[u]:
				if not vst[v]:
					vst[v] = C
					q.append(v)
		SIZE.append(cnt)
for i in range(N):
	ret = SIZE[vst[i] - 1] - 1
	ret -= len(friend[i])
	for b in block[i]:
		if vst[i] == vst[b]:
			ret -= 1
	print(ret, end=' ')
print()


from collections import deque
(N, M, K) = map(int, input().split())
F = {i: set() for i in range(1, N + 1)}
B = {i: set() for i in range(1, N + 1)}
for _ in range(M):
	(a, b) = map(int, input().split())
	F[a].add(b)
	F[b].add(a)
for _ in range(K):
	(c, d) = map(int, input().split())
	B[c].add(d)
	B[d].add(c)
A = []
hist = [-1 for _ in range(N + 1)]
cnt = -1
for i in range(1, N + 1):
	if hist[i] < 0:
		cnt += 1
		A1 = set()
		que = deque([i])
		hist[i] = cnt
		A1.add(i)
		while que:
			x = que.popleft()
			for y in F[x]:
				if hist[y] < 0:
					A1.add(y)
					que.append(y)
					hist[y] = cnt
		A.append(A1)
C = []
for i in range(1, N + 1):
	cnt = hist[i]
	a = A[cnt] & B[i]
	C.append(len(A[cnt]) - len(F[i]) - len(a) - 1)
print(*C)


import sys
sys.setrecursionlimit(10 ** 6)
from collections import Counter

def dfs(nw):
	for nx in F[nw]:
		if V[nx] == -1:
			V[nx] = cnt
			dfs(nx)
(n, m, k) = list(map(int, sys.stdin.readline().split()))
F = [[] for _ in range(n)]
B = [[] for _ in range(n)]
for i in range(m):
	(a, b) = map(lambda x: int(x) - 1, map(int, sys.stdin.readline().split()))
	F[a].append(b)
	F[b].append(a)
for i in range(k):
	(c, d) = map(lambda x: int(x) - 1, map(int, sys.stdin.readline().split()))
	B[c].append(d)
	B[d].append(c)
V = [-1] * n
cnt = 1
for i in range(n):
	if V[i] == -1:
		V[i] = cnt
		dfs(i)
		cnt += 1
cV = Counter(V)
ans = []
for i in range(n):
	ans.append(cV[V[i]] - 1 - len(F[i]) - sum([V[b] == V[i] for b in B[i]]))
print(*ans)


class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join(('{}: {}'.format(r, self.members(r)) for r in self.roots()))
(N, M, K) = map(int, input().split())
tree = UnionFind(N)
not_friend_candidates = []
for i in range(M):
	(A, B) = list(map(int, input().split()))
	A -= 1
	B -= 1
	tree.union(A, B)
	not_friend_candidates.append([A, B])
for j in range(K):
	(C, D) = list(map(int, input().split()))
	C -= 1
	D -= 1
	not_friend_candidates.append([C, D])
ans = [0] * N
for (i, j) in not_friend_candidates:
	if tree.same(i, j):
		ans[i] -= 1
		ans[j] -= 1
for i in range(N):
	ans[i] += tree.size(i) - 1
print(*ans)


(N, M, K) = map(int, input().split())
a = [0] * M
b = [0] * M
c = [0] * K
d = [0] * K
for i in range(M):
	(a[i], b[i]) = map(int, input().split())
for i in range(K):
	(c[i], d[i]) = map(int, input().split())
l = list(range(N + 1))
r = [0] * (N + 1)
size = [1] * (N + 1)
la = N
di = [[] for _ in range(N + 1)]

def find(x):
	if l[x] == x:
		return x
	else:
		return find(l[x])

def union(x, y):
	X = find(x)
	Y = find(y)
	if r[X] > r[Y]:
		l[Y] = l[X]
		size[X] += size[Y]
	else:
		l[X] = l[Y]
		if r[X] == r[Y]:
			r[Y] += 1
		if X != Y:
			size[Y] += size[X]
for i in range(M):
	union(a[i], b[i])
	di[a[i]].append(b[i])
	di[b[i]].append(a[i])
for i in range(K):
	if find(c[i]) == find(d[i]):
		di[c[i]].append(d[i])
		di[d[i]].append(c[i])
t = []
for i in range(N + 1):
	p = size[find(i)] - 1 - len(di[i])
	t.append(p)
print(' '.join(map(str, t[1:])))


import sys
input = sys.stdin.readline

class UnionFind:

	def __init__(self, numV):
		self.pars = list(range(numV))
		self.ranks = [0] * numV
		self.sizes = [1] * numV

	def getRoot(self, x):
		par = self.pars[x]
		if par != x:
			self.pars[x] = par = self.getRoot(par)
		return par

	def merge(self, x, y):
		(x, y) = (self.getRoot(x), self.getRoot(y))
		(sx, sy) = (self.sizes[x], self.sizes[y])
		if x == y:
			return (0, 0)
		if self.ranks[x] < self.ranks[y]:
			self.pars[x] = y
			self.sizes[y] += sx
		else:
			self.pars[y] = x
			self.sizes[x] += sy
			if self.ranks[x] == self.ranks[y]:
				self.ranks[x] += 1
		return (sx, sy)

	def isSame(self, x, y):
		return self.getRoot(x) == self.getRoot(y)

	def updatePars(self):
		for v in range(len(self.pars)):
			self.getRoot(v)

	def getSize(self, x):
		return self.sizes[self.getRoot(x)]
(N, M, K) = list(map(int, input().split()))
UF = UnionFind(N)
anss = [-1] * N
for _ in range(M):
	(A, B) = list(map(int, input().split()))
	(A, B) = (A - 1, B - 1)
	UF.merge(A, B)
	anss[A] -= 1
	anss[B] -= 1
for i in range(N):
	anss[i] += UF.getSize(i)
for _ in range(K):
	(C, D) = list(map(int, input().split()))
	(C, D) = (C - 1, D - 1)
	if UF.isSame(C, D):
		anss[C] -= 1
		anss[D] -= 1
print(' '.join(map(str, anss)))


(n, m, k) = [int(j) for j in input().split()]
par = [-1 for i in range(n)]

def root(a):
	if par[a] < 0:
		return a
	else:
		return root(par[a])

def size(a):
	return -par[root(a)]

def connect(a, b):
	a = root(a)
	b = root(b)
	if a == b:
		return False
	if size(a) < size(b):
		(a, b) = (b, a)
	par[a] += par[b]
	par[b] = a
	return True
f = set((tuple((int(j) - 1 for j in input().split())) for _ in range(m)))
b = set((tuple((int(j) - 1 for j in input().split())) for _ in range(k)))
for a in f:
	if root(a[0]) != root(a[1]):
		connect(a[0], a[1])
ans = []
for i in range(n):
	ans.append(-par[root(i)] - 1)
for (i, j) in f:
	if root(i) == root(j):
		ans[i] -= 1
		ans[j] -= 1
for (i, j) in b:
	if root(i) == root(j):
		ans[i] -= 1
		ans[j] -= 1
print(*ans)


import sys
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
friend = [[] for _ in range(n + 1)]
block = [[] for _ in range(n + 1)]
par = [-1] * (n + 1)

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def size(x):
	return -par[find(x)]

def unite(x, y):
	if find(x) == find(y):
		return False
	if size(x) < size(y):
		(x, y) = (y, x)
	X = find(x)
	Y = find(y)
	par[X] += par[Y]
	par[Y] = X
	return True

def is_same(x, y):
	return find(x) == find(y)
for _ in range(m):
	(a, b) = map(int, input().split())
	friend[a].append(b)
	friend[b].append(a)
	unite(a, b)
for _ in range(k):
	(c, d) = map(int, input().split())
	if is_same(c, d):
		block[c].append(d)
		block[d].append(c)
ans = [0] * (n + 1)
for i in range(1, n + 1):
	f = size(i) - 1 - len(friend[i])
	b = len(block[i])
	ans[i] = f - b
print(*ans[1:], sep=' ')


(n, m, k) = map(int, input().split())

class UnionFind:

	def __init__(self, n):
		self.ps = [-1] * (n + 1)

	def find(self, x):
		if self.ps[x] < 0:
			return x
		else:
			self.ps[x] = self.find(self.ps[x])
			return self.ps[x]

	def unite(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return False
		if self.ps[x] > self.ps[y]:
			(x, y) = (y, x)
		self.ps[x] += self.ps[y]
		self.ps[y] = x
		return True

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def size(self, x):
		x = self.find(x)
		return -self.ps[x]
all1 = [0] * n
uf = UnionFind(n)
for i in range(m):
	(a, b) = map(int, input().split())
	uf.unite(a, b)
	(a, b) = (a - 1, b - 1)
	all1[a] += 1
	all1[b] += 1
ans = [uf.size(x) - 1 - all1[x - 1] for x in range(1, n + 1)]
for i in range(k):
	(a, b) = map(int, input().split())
	if uf.same(a, b):
		(a, b) = (a - 1, b - 1)
		ans[a] -= 1
		ans[b] -= 1
print(*ans)


import sys
sys.setrecursionlimit(2147483647)
input = sys.stdin.readline
(N, M, K) = map(int, input().split())
friends = {i: set() for i in range(N)}
blocks = {i: set() for i in range(N)}
for _ in range(M):
	(a, b) = map(int, input().split())
	friends[a - 1].add(b - 1)
	friends[b - 1].add(a - 1)
for _ in range(K):
	(a, b) = map(int, input().split())
	blocks[a - 1].add(b - 1)
	blocks[b - 1].add(a - 1)
counts = [0] * N
seen = [False] * N

def dfs(v):
	if seen[v] == True:
		return
	seen[v] = True
	for node in friends[v]:
		c.add(node)
		dfs(node)
for v in range(N):
	if seen[v] == True:
		continue
	c = set()
	dfs(v)
	l = len(c)
	for i in c:
		counts[i] = l - 1
		counts[i] -= len(c & friends[i])
		counts[i] -= len(c & blocks[i])
print(' '.join(map(str, counts)))


import queue
(N, M, K) = map(int, input().split())
friend = [[] for i in range(N)]
block = [[] for i in range(N)]
color = [-1] * N
c = 0
for i in range(M):
	(a, b) = map(int, input().split())
	friend[a - 1].append(b - 1)
	friend[b - 1].append(a - 1)
for i in range(K):
	(a, b) = map(int, input().split())
	block[a - 1].append(b - 1)
	block[b - 1].append(a - 1)
q = queue.Queue()
count = [0] * N
for i in range(N):
	if color[i] == -1:
		q.put(i)
		color[i] = c
		count[c] += 1
		while not q.empty():
			s = q.get()
			for t in friend[s]:
				if color[t] == -1:
					color[t] = c
					count[c] += 1
					q.put(t)
		c += 1
for i in range(N):
	block_in_color = 0
	for t in block[i]:
		if color[i] == color[t]:
			block_in_color += 1
	print(count[color[i]] - len(friend[i]) - block_in_color - 1)


(n, m, k) = list(map(int, input().split()))
friend = [[] for i in range(n)]
block = [[] for i in range(n)]

class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join(('{}: {}'.format(r, self.members(r)) for r in self.roots()))
uf = UnionFind(n)
for i in range(m):
	(a, b) = list(map(int, input().split()))
	a -= 1
	b -= 1
	uf.union(a, b)
	friend[a].append(b)
	friend[b].append(a)
for i in range(k):
	(c, d) = list(map(int, input().split()))
	c -= 1
	d -= 1
	block[c].append(d)
	block[d].append(c)
ans = []
for i in range(n):
	ans1 = uf.size(i) - 1
	for j in block[i]:
		if uf.same(i, j):
			ans1 -= 1
	ans1 -= len(friend[i])
	ans.append(str(ans1))
print(' '.join(ans))


class UnionFind(object):

	def __init__(self, n=1):
		self.par = [i for i in range(n)]
		self.rank = [0 for _ in range(n)]
		self.size = [1 for _ in range(n)]

	def find(self, x):
		if self.par[x] == x:
			return x
		else:
			self.par[x] = self.find(self.par[x])
			return self.par[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x != y:
			if self.rank[x] < self.rank[y]:
				(x, y) = (y, x)
			if self.rank[x] == self.rank[y]:
				self.rank[x] += 1
			self.par[y] = x
			self.size[x] += self.size[y]

	def is_same(self, x, y):
		return self.find(x) == self.find(y)

	def get_size(self, x):
		x = self.find(x)
		return self.size[x]
(n, m, k) = map(int, input().split())
uf = UnionFind(n + 1)
cnt = [0] * (n + 1)
for _ in range(m):
	(a, b) = map(int, input().split())
	uf.union(a, b)
	cnt[a] += 1
	cnt[b] += 1
for _ in range(k):
	(c, d) = map(int, input().split())
	if uf.is_same(c, d):
		cnt[c] += 1
		cnt[d] += 1
for i in range(1, n + 1):
	print(uf.get_size(i) - cnt[i] - 1, end=' ')


(n, m, k) = map(int, input().split())
g = [[] for i in range(n + 1)]
f = [0] * (n + 1)
b = []
for i in range(m):
	(u, v) = map(int, input().split())
	g[u].append(v)
	g[v].append(u)
	f[u] += 1
	f[v] += 1
for i in range(k):
	b.append(map(int, input().split()))
count = 0
renketu_list = [-1] * (n + 1)
renketu_size = [0]
stack = []
for i in range(1, n + 1):
	if renketu_list[i] == -1:
		count += 1
		renketu_list[i] = count
		renketu_size.append(1)
		while len(g[i]) > 0:
			stack.append(g[i].pop())
		while len(stack) > 0:
			v = stack.pop()
			if renketu_list[v] == -1:
				renketu_list[v] = count
				renketu_size[count] += 1
				while len(g[v]) > 0:
					stack.append(g[v].pop())
s = [0] * (n + 1)
for i in range(1, n + 1):
	s[i] += renketu_size[renketu_list[i]] - f[i] - 1
for i in range(k):
	(u, v) = b[i]
	if renketu_list[u] == renketu_list[v]:
		s[u] -= 1
		s[v] -= 1
print(' '.join(list(map(str, s[1:]))))


def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def unite(x, y):
	(x, y) = (find(x), find(y))
	if x != y:
		if x > y:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x

def same(x, y):
	return find(x) == find(y)

def size(x):
	return -par[find(x)]
(n, m, k) = map(int, input().split())
par = [-1] * n
FF = [0] * n
BB = [[] for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	unite(a - 1, b - 1)
	FF[a - 1] += 1
	FF[b - 1] += 1
for i in range(k):
	(a, b) = map(int, input().split())
	BB[a - 1].append(b - 1)
	BB[b - 1].append(a - 1)
result = []
for i in range(n):
	ans = size(i) - FF[i] - 1
	for j in BB[i]:
		if same(i, j):
			ans -= 1
	result.append(ans)
print(*result)


(n, m, k) = map(int, input().split())
friends = [set() for _ in range(n + 1)]
blocked = [set() for _ in range(n + 1)]
for i in range(m):
	(a, b) = map(int, input().split())
	friends[a].add(b)
	friends[b].add(a)
for i in range(k):
	(c, d) = map(int, input().split())
	blocked[c].add(d)
	blocked[d].add(c)
checked = set()
ans = [0] * (n + 1)
for i in range(1, n + 1):
	if i in checked:
		continue
	stack = list(friends[i])
	chain = set()
	while stack:
		f = stack.pop()
		if f in checked:
			continue
		chain.add(f)
		checked.add(f)
		stack.extend(friends[f])
	cnt = len(chain) - 1
	for c in chain:
		ans[c] = cnt - len(chain & (friends[c] | blocked[c]))
print(*ans[1:])


def LI():
	return list(map(int, input().split()))

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def unite(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return False
	else:
		if par[x] > par[y]:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x
		return True

def same(x, y):
	return find(x) == find(y)

def size(x):
	return -par[find(x)]
(N, M, K) = LI()
par = [-1] * N
not_kouho = [[] for _ in range(N)]
for i in range(M):
	(a, b) = map(int, input().split())
	unite(a - 1, b - 1)
	not_kouho[a - 1].append(b - 1)
	not_kouho[b - 1].append(a - 1)
for i in range(K):
	(a, b) = map(int, input().split())
	if same(a - 1, b - 1):
		not_kouho[a - 1].append(b - 1)
		not_kouho[b - 1].append(a - 1)
for i in range(N):
	print(size(i) - len(not_kouho[i]) - 1, end=' ')


from sys import stdin

def getval():
	(n, m, k) = map(int, stdin.readline().split())
	a = [list(map(int, stdin.readline().split())) for i in range(m)]
	c = [list(map(int, stdin.readline().split())) for i in range(k)]
	return (n, m, k, a, c)

def main(n, m, k, a, c):
	friends = [[] for i in range(n)]
	for i in a:
		friends[i[0] - 1].append(i[1] - 1)
		friends[i[1] - 1].append(i[0] - 1)
	frgroups = []
	visited = [False for i in range(n)]
	for i in range(n):
		if visited[i]:
			continue
		q = [i]
		temp = [i]
		visited[i] = True
		while q:
			idx = q.pop(0)
			adj = friends[idx]
			for j in adj:
				if visited[j]:
					continue
				visited[j] = True
				q.append(j)
				temp.append(j)
		frgroups.append(temp)
	groups = [-1 for i in range(n)]
	for i in range(len(frgroups)):
		for j in frgroups[i]:
			groups[j] = i
	ans = [len(frgroups[groups[i]]) - 1 - len(friends[i]) for i in range(n)]
	for i in c:
		if groups[i[0] - 1] == groups[i[1] - 1]:
			ans[i[0] - 1] -= 1
			ans[i[1] - 1] -= 1
	s = str(ans[0])
	for i in range(1, n):
		s += ' ' + str(ans[i])
	print(s)

def __starting_point():
	(n, m, k, a, c) = getval()
	main(n, m, k, a, c)
__starting_point()


(n, m, k) = map(int, input().split())
root = [i for i in range(n)]
height = [1 for i in range(n)]

def find(n):
	sn = n
	while n != root[n]:
		n = root[n]
	root[sn] = n
	return n

def union(a, b):
	a = find(a)
	b = find(b)
	if a == b:
		return
	elif height[a] >= height[b]:
		height[a] += height[b]
		height[b] = 0
		root[b] = a
	else:
		height[b] += height[a]
		height[a] = 0
		root[a] = b
l = [set() for _ in range(n)]
for i in range(m):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	union(a, b)
	l[a].add(b)
	l[b].add(a)
for i in range(k):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	if find(a) == find(b):
		l[a].add(b)
		l[b].add(a)
print(*[height[find(i)] - len(l[i]) - 1 for i in range(n)])


import sys
sys.setrecursionlimit(10 ** 9)
(n, m, k) = map(int, input().split())
F = [[] for i in range(n)]
B = [set() for i in range(n)]
l = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	F[a - 1].append(b - 1)
	F[b - 1].append(a - 1)
for i in range(k):
	(c, d) = map(int, input().split())
	B[c - 1].add(d - 1)
	B[d - 1].add(c - 1)
seen = [0] * n
cnt = 0
r = []

def dfs(x):
	if seen[x] == 0:
		r[cnt].add(x)
		seen[x] = 1
		for i in F[x]:
			dfs(i)
for i in range(n):
	if seen[i] == 0:
		r.append(set())
		dfs(i)
		cnt += 1
ans = [0] * n
for i in r:
	lr = len(i)
	for j in i:
		ans[j] = lr - len(F[j]) - len(i & B[j]) - 1
print(*ans)


def root(x):
	while par[x] >= 0:
		x = par[x]
	return x

def unite(x, y):
	rx = root(x)
	ry = root(y)
	if rx != ry:
		if rx > ry:
			(rx, ry) = (ry, rx)
		par[rx] += par[ry]
		par[ry] = rx

def same(x, y):
	rx = root(x)
	ry = root(y)
	return rx == ry

def size(x):
	return -par[root(x)]
(N, M, K) = map(int, input().split())
par = [-1] * N
g = [[] for _ in range(N)]
for i in range(M):
	(A, B) = map(int, input().split())
	(A, B) = (A - 1, B - 1)
	unite(A, B)
	g[A].append(B)
	g[B].append(A)
for i in range(K):
	(C, D) = map(int, input().split())
	(C, D) = (C - 1, D - 1)
	if same(C, D):
		g[C].append(D)
		g[D].append(C)
for i in range(N):
	print(size(i) - len(g[i]) - 1, end=' ')


r = lambda x: p[x] >= 0 and r(p[x]) or x
((n, m, k), *t) = [map(int, t.split()) for t in open(0)]
(p, f) = ([-1] * -~n, [-1] * -~n)
for (a, b) in t[:m]:
	(x, y) = (r(a), r(b))
	if x != y:
		if x > y:
			(x, y) = (y, x)
		p[x] += p[y]
		p[y] = x
	f[a] -= 1
	f[b] -= 1
a = [f[i] - p[r(i)] for i in range(n + 1)]
for (c, d) in t[m:]:
	if r(c) == r(d):
		a[c] -= 1
		a[d] -= 1
print(*a[1:])


from collections import deque
(n, m, k) = map(int, input().split())
next = [[] for i in range(n)]
num_next = [0] * n
block = [[] for i in range(n)]
for i in range(m):
	(x, y) = map(int, input().split())
	next[y - 1].append(x - 1)
	next[x - 1].append(y - 1)
	num_next[x - 1] += 1
	num_next[y - 1] += 1
for j in range(k):
	(x, y) = map(int, input().split())
	block[y - 1].append(x - 1)
	block[x - 1].append(y - 1)
friend = []
num = {}
mark = ['t'] * n
for i in range(n):
	if mark[i] == 't':
		mark[i] = i
		s = 1
		que = deque([i])
		while que:
			p = que.popleft()
			for x in next[p]:
				if mark[x] == 't':
					mark[x] = mark[p]
					s += 1
					que.append(x)
		num[i] = s
ans = []
for i in range(n):
	l = num[mark[i]] - 1 - num_next[i]
	for y in block[i]:
		if mark[y] == mark[i]:
			l -= 1
	ans.append(str(l))
print(' '.join(ans))


(N, M, K) = map(int, input().split())
par = [-1 for _ in range(N)]
nums = [-1 for _ in range(N)]

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def size(x):
	return -par[find(x)]

def unite(x, y):
	(x, y) = (find(x), find(y))
	if x == y:
		return
	if x > y:
		(x, y) = (y, x)
	par[x] += par[y]
	par[y] = x

def same(x, y):
	return find(x) == find(y)
for _ in range(M):
	(a1, a2) = map(int, input().split())
	a1 -= 1
	a2 -= 1
	unite(a1, a2)
	nums[a1] -= 1
	nums[a2] -= 1
for _ in range(K):
	(a1, a2) = map(int, input().split())
	a1 -= 1
	a2 -= 1
	if same(a1, a2):
		nums[a1] -= 1
		nums[a2] -= 1
for i in range(N):
	nums[i] += size(i)
print(' '.join(list(map(str, nums))))


class UnionFind:

	def __init__(self, n):
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return self.parents[self.find(x)]
(N, M, K) = map(int, input().split())
uf = UnionFind(N + 1)
friends = {x: set() for x in range(1, N + 1)}
blocks = {x: set() for x in range(1, N + 1)}
ans = [N - 1] * (N + 1)
for _ in range(M):
	(A, B) = map(int, input().split())
	friends[A].add(B)
	friends[B].add(A)
	uf.union(A, B)
for _ in range(K):
	(C, D) = map(int, input().split())
	if uf.find(C) == uf.find(D):
		blocks[C].add(D)
		blocks[D].add(C)
for i in range(1, N + 1):
	if uf.size(i) == -1:
		print(0)
		continue
	print(abs(uf.size(i)) - len(friends[i]) - len(blocks[i]) - 1, end=' ')


class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join(('{}: {}'.format(r, self.members(r)) for r in self.roots()))
(n, m, k) = map(int, input().split())
V = [[] for i in range(n + 1)]
W = [0] * (n + 1)
uf = UnionFind(n + 1)
for _ in range(m):
	(a, b) = map(int, input().split())
	V[a].append(b)
	V[b].append(a)
	uf.union(a, b)
for _ in range(k):
	(c, d) = map(int, input().split())
	if uf.find(d) == uf.find(c):
		W[c] += 1
		W[d] += 1
for i in range(1, n + 1):
	ans = uf.size(i) - len(V[i]) - W[i] - 1
	print(ans, end='')
	print(' ', end='')
print()


import time
from collections import deque
(N, M, K) = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
CD = [list(map(int, input().split())) for _ in range(K)]
F = [set() for _ in range(N)]
B = [set() for _ in range(N)]
for (i, j) in AB:
	F[i - 1].add(j - 1)
	F[j - 1].add(i - 1)
for (i, j) in CD:
	B[i - 1].add(j - 1)
	B[j - 1].add(i - 1)
Q = deque()
S = [0] * N
d = [0] * N
for i in range(N):
	if d[i] != 0:
		continue
	L = {i}
	d[i] = 1
	Q.append(i)
	while len(Q) > 0:
		q = Q.pop()
		for j in F[q]:
			if d[j] == 0:
				d[j] = 1
				Q.append(j)
				L.add(j)
	for k in L:
		S[k] = len(L) - len(L & F[k]) - len(L & B[k]) - 1
print(*S)


class UnionFind:

	def __init__(self, n=0):
		self.d = [-1] * n

	def find(self, x):
		if self.d[x] < 0:
			return x
		else:
			self.d[x] = self.find(self.d[x])
			return self.d[x]

	def unite(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return False
		if self.d[x] > self.d[y]:
			(x, y) = (y, x)
		self.d[x] += self.d[y]
		self.d[y] = x
		return True

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def size(self, x):
		return -self.d[self.find(x)]
(n, m, k) = map(int, input().split())
deg = [0] * 100005
uf = UnionFind(n)
for _ in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	deg[a] += 1
	deg[b] += 1
	uf.unite(a, b)
for _ in range(k):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	if uf.same(c, d):
		deg[c] += 1
		deg[d] += 1
for i in range(n):
	print(uf.size(i) - 1 - deg[i], end='')
	if i == n - 1:
		print()
	else:
		print(' ', end='')


import sys
input = sys.stdin.readline
import bisect
(n, m, k) = [int(i) for i in input().split()]
ans = [-1] * n

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def unite(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return False
	else:
		if par[x] > par[y]:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x
		return True

def size(x):
	return -par[find(x)]
par = [-1] * n
g = [[] * n for i in range(n)]
for i in range(m):
	(a, b) = [int(i) for i in input().split()]
	unite(a - 1, b - 1)
	ans[a - 1] -= 1
	ans[b - 1] -= 1

def same(x, y):
	return find(x) == find(y)
for i in range(k):
	(u, v) = map(int, input().split())
	if same(u - 1, v - 1):
		ans[u - 1] -= 1
		ans[v - 1] -= 1
for i in range(n):
	ans[i] += size(i)
print(*ans)


import sys
import collections
(n, m, k) = map(int, input().split())
pairs = [tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(m)]
node = [[] for _ in range(n)]
block = [[] for _ in range(n)]
for p in pairs:
	node[p[0]].append(p[1])
	node[p[1]].append(p[0])
s = 0
seen = [None] * n
sys.setrecursionlimit(10 ** 9)

def dfs(v, c):
	seen[v] = c
	for next_v in node[v]:
		if seen[next_v] != None:
			continue
		else:
			dfs(next_v, c)
for i in range(n):
	if seen[i] != None:
		continue
	else:
		dfs(i, s)
		s += 1
for i in range(k):
	(c, d) = map(lambda x: int(x) - 1, input().split())
	if seen[c] == seen[d]:
		block[c].append(d)
		block[d].append(c)
count = collections.Counter(seen)
for i in range(n):
	print(count[seen[i]] - len(node[i]) - 1 - len(block[i]))


import sys
sys.setrecursionlimit(100000000)

class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return {i for i in range(self.n) if self.find(i) == root}

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join(('{}: {}'.format(r, self.members(r)) for r in self.roots()))
(n, m, k) = map(int, input().split())
block = [0] * n
uf = UnionFind(n)
for _ in range(m):
	(a, b) = map(int, input().split())
	block[a - 1] += 1
	block[b - 1] += 1
	uf.union(a - 1, b - 1)
uf.find(0)
for _ in range(k):
	(c, d) = map(int, input().split())
	if uf.same(c - 1, d - 1):
		block[c - 1] += 1
		block[d - 1] += 1
ans = [uf.size(i) - block[i] - 1 for i in range(n)]
print(*ans)


(n, m, k) = map(int, input().split())
import sys
rks = [None] * n
sys.setrecursionlimit(10 ** 9)
fgraph = [list() for i in range(n)]
bgraph = [list() for i in range(n)]
cgraph = [list() for i in range(n)]
g = [[] for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	fgraph[a - 1].append(b)
	fgraph[b - 1].append(a)

def dfs(graph, s, r):
	if rks[s] is None:
		rks[s] = r
	for i in range(len(graph[s])):
		if rks[graph[s][i] - 1] is not None:
			continue
		g[r].append(0)
		dfs(graph, graph[s][i] - 1, r)
c = -1
for i in range(n):
	if rks[i] is None:
		c += 1
		dfs(fgraph, i, c)
for i in range(k):
	(c, d) = map(int, input().split())
	if rks[c - 1] == rks[d - 1]:
		bgraph[d - 1].append(c)
		bgraph[c - 1].append(d)
for i in range(n):
	print(len(g[rks[i]]) - len(fgraph[i]) - len(bgraph[i]))


import sys
f = lambda : tuple(map(int, sys.stdin.readline().split()))
(n, m, k) = f()
lta = [f() for _ in range(m)]
ltb = [f() for _ in range(k)]
p = [-1] * n

def root(x):
	while p[x] >= 0:
		x = p[x]
	return x

def unite(x, y):
	(x, y) = (root(x), root(y))
	if x == y:
		return
	if x > y:
		(x, y) = (y, x)
	p[x] += p[y]
	p[y] = x

def same(x, y):
	return root(x) == root(y)

def size(x):
	return -p[root(x)]
l = [0] * n
for (a, b) in lta:
	unite(a - 1, b - 1)
	l[a - 1] -= 1
	l[b - 1] -= 1
for (c, d) in ltb:
	if same(c - 1, d - 1):
		l[c - 1] -= 1
		l[d - 1] -= 1
for i in range(n):
	l[i] += size(i) - 1
print(*l)


from _collections import deque
(n, m, k) = map(int, input().split())
import sys
sys.setrecursionlimit(10 ** 9)
fre = [[] for _ in range(n + 1)]
bro = [[] for _ in range(n + 1)]
for i in range(m):
	(a, b) = map(int, input().split())
	fre[a].append(b)
	fre[b].append(a)
for i in range(k):
	(a, b) = map(int, input().split())
	bro[a].append(b)
	bro[b].append(a)
ans = []
x = [-1] * (n + 1)

def s(y):
	global i
	if x[y] > 0:
		return
	x[y] = i
	for j in fre[y]:
		if x[j] == -1:
			s(j)
for i in range(1, n + 1):
	s(i)
g = [0] * (n + 1)
for i in range(1, n + 1):
	g[x[i]] += 1
for i in range(1, n + 1):
	g[i] = g[x[i]]
for i in range(1, n + 1):
	aa = g[i] - 1
	aa -= len(fre[i])
	for j in bro[i]:
		if x[i] == x[j]:
			aa -= 1
	ans.append(str(aa))
print(' '.join(ans))


(N, M, K) = list(map(int, input().split()))
p = [0] * N
for i in range(N):
	p[i] = [0] * 3
	p[i][0] = []
	p[i][1] = []
	p[i][2] = -1
g = []
stack = []
groupNum = 0
fcs = []
for i in range(M):
	(a, b) = list(map(int, input().split()))
	p[a - 1][0].append(b - 1)
	p[b - 1][0].append(a - 1)

def groupmake(person, group):
	groupSize = 0
	stack.append(person)
	p[person][2] = group
	while True:
		num = stack.pop()
		groupSize += 1
		for i in p[num][0]:
			if p[i][2] == -1:
				stack.append(i)
				p[i][2] = group
		if len(stack) == 0:
			return groupSize
for i in range(len(p)):
	if p[i][2] == -1:
		g.append(groupmake(i, groupNum))
		groupNum += 1
for person in p:
	fcs.append(g[person[2]] - len(person[0]) - 1)
for i in range(K):
	(c, d) = list(map(int, input().split()))
	if p[c - 1][2] == p[d - 1][2]:
		fcs[c - 1] -= 1
		fcs[d - 1] -= 1
print(' '.join(map(str, fcs)))


from collections import deque
(N, M, K) = (int(x) for x in input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
CD = [list(map(int, input().split())) for _ in range(K)]
friends = [set() for _ in range(N)]
blocks = [set() for _ in range(N)]
searched = [0] * N
ans = [0] * N
d = deque()
for (x, y) in AB:
	friends[x - 1].add(y - 1)
	friends[y - 1].add(x - 1)
for (x, y) in CD:
	blocks[x - 1].add(y - 1)
	blocks[y - 1].add(x - 1)
for i in range(N):
	if searched[i]:
		continue
	trace = set()
	d.append(i)
	trace.add(i)
	searched[i] = 1
	while d:
		temp = d.popleft()
		for x in friends[temp]:
			if searched[x] == 0:
				d.append(x)
				trace.add(x)
				searched[x] = 1
	chain = len(trace)
	for j in trace:
		ans[j] = chain - 1 - len(trace & friends[j]) - len(trace & blocks[j])
print(*ans)


(N, M, K) = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(M)]
CD = [tuple(map(int, input().split())) for _ in range(K)]

def root(x, P):
	l = []
	n = x
	p = P[n]
	while p >= 0:
		l.append(n)
		n = p
		p = P[p]
	for a in l:
		P[a] = n
	return n

def same(a, b, P):
	return root(a, P) == root(b, P)

def count(x, P):
	return -P[root(x, P)]

def unite(a, b, P):
	if count(a, P) < count(b, P):
		(a, b) = (b, a)
	ar = root(a, P)
	br = root(b, P)
	if ar == br:
		return
	P[ar] += P[br]
	P[br] = ar
Fu = [-1] * N
F = [set() for _ in range(N)]
B = [set() for _ in range(N)]
for (a, b) in AB:
	(a, b) = (a - 1, b - 1)
	unite(a, b, Fu)
	F[a].add(b)
	F[b].add(a)
for (c, d) in CD:
	(c, d) = (c - 1, d - 1)
	B[c].add(d)
	B[d].add(c)
for i in range(N):
	block = 0
	for b in B[i]:
		if same(i, b, Fu):
			block += 1
	print(count(i, Fu) - len(F[i]) - block - 1, end=' ')


class UF:

	def __init__(self, N):
		self.uf = [-1] * N
		self.n = N

	def find(self, x):
		if self.uf[x] < 0:
			return x
		self.uf[x] = self.find(self.uf[x])
		return self.uf[x]

	def size(self, x):
		return -self.uf[self.find(x)]

	def union(self, x, y):
		(x, y) = (self.find(x), self.find(y))
		if x == y:
			return
		if self.size(x) > self.size(y):
			(x, y) = (y, x)
		self.uf[y] += self.uf[x]
		self.uf[x] = y
		self.n -= 1
(N, M, K) = map(int, input().split())
uf = UF(N)
F = [0] * N
for _ in range(M):
	(A, B) = map(int, input().split())
	uf.union(A - 1, B - 1)
	F[A - 1] += 1
	F[B - 1] += 1
G = [0] * N
for i in range(N):
	G[i] = uf.size(i) - F[i] - 1
for _ in range(K):
	(C, D) = map(int, input().split())
	if uf.find(C - 1) != uf.find(D - 1):
		continue
	G[C - 1] -= 1
	G[D - 1] -= 1
print(*G)


(n, m, k) = [int(x) for x in input().split()]
fr = [i for i in range(n)]
dfr = [[] for i in range(n)]
bl = [[] for i in range(n)]

def deref(a):
	s = []
	while True:
		next = fr[a]
		if next == a:
			break
		s.append(a)
		a = next
	for i in s:
		fr[i] = a
	return a

def merge(a, b):
	(ra, rb) = (deref(a), deref(b))
	fr[rb] = ra
for i in range(m):
	(a, b) = [int(x) - 1 for x in input().split()]
	dfr[a].append(b)
	dfr[b].append(a)
	(a, b) = (min(a, b), max(a, b))
	merge(a, b)
for i in range(n):
	deref(i)
ss = [[] for i in range(n)]
for i in range(n):
	ss[fr[i]].append(i)
for i in range(k):
	(c, d) = [int(x) - 1 for x in input().split()]
	bl[c].append(d)
	bl[d].append(c)
for i in range(n):
	bl[i].sort()
r = []
for i in range(n):
	v = len(ss[fr[i]]) - len(dfr[i]) - 1
	v -= sum((fr[j] == fr[i] for j in bl[i]))
	r.append(v)
print(' '.join((str(x) for x in r)))


from collections import deque
(n, m, k) = map(int, input().split())
F = [set() for i in range(n)]
B = [set() for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	F[a].add(b)
	F[b].add(a)
for i in range(k):
	(c, d) = map(int, input().split())
	(c, d) = (c - 1, d - 1)
	B[c].add(d)
	B[d].add(c)
T = [set() for i in range(n)]
D = [0] * n
R = [0] * n
for i in range(n):
	if D[i]:
		continue
	que = deque([])
	que.append(i)
	S = set()
	S.add(i)
	while que:
		p = que.popleft()
		for np in F[p]:
			if D[np] != 1:
				que.append(np)
				S.add(np)
				D[np] = 1
	for s in S:
		R[s] = len(S) - len(F[s]) - len(S & B[s]) - 1
print(*R)


(n, m, k) = map(int, input().split())
par = [-1] * n

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def unite(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return False
	else:
		if par[x] > par[y]:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x
		return True

def same(x, y):
	return find(x) == find(y)

def size(x):
	return -par[find(x)]
F = [-1] * n
l = []
for _ in range(m):
	(a, b) = map(int, input().split())
	l.append([a - 1, b - 1])
	unite(a - 1, b - 1)
for _ in range(k):
	(a, b) = map(int, input().split())
	if same(a - 1, b - 1):
		F[a - 1] -= 1
		F[b - 1] -= 1
for (i, j) in l:
	if same(i, j):
		F[i] -= 1
		F[j] -= 1
for i in range(n):
	F[i] += size(i)
print(*F)


class UnionFind:

	def __init__(self, n):
		self.n = n
		self.root = [-1] * n
		self.rank = [0] * n

	def find_root(self, x):
		if self.root[x] < 0:
			return x
		else:
			self.root[x] = self.find_root(self.root[x])
			return self.root[x]

	def unite(self, x, y):
		x = self.find_root(x)
		y = self.find_root(y)
		if x == y:
			return
		elif self.rank[x] > self.rank[y]:
			self.root[x] += self.root[y]
			self.root[y] = x
		else:
			self.root[y] += self.root[x]
			self.root[x] = y
			if self.rank[x] == self.rank[y]:
				self.rank[y] += 1

	def same(self, x, y):
		return self.find_root(x) == self.find_root(y)

	def count(self, x):
		return -self.root[self.find_root(x)]

	def members(self, x):
		root = self.find_root(x)
		return [i for i in range(self.n) if self.find_root(i) == root]

	def roots(self):
		return [i for (i, x) in enumerate(self.root) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}
(N, M, K) = map(int, input().rstrip().split())
AB = [list(map(int, input().rstrip().split())) for _ in range(M)]
CD = [list(map(int, input().rstrip().split())) for _ in range(K)]
u = UnionFind(N)
for (a, b) in AB:
	u.unite(a - 1, b - 1)
ans = [u.count(i) - 1 for i in range(N)]
ans
for (a, b) in AB:
	if u.same(a - 1, b - 1):
		ans[a - 1] -= 1
		ans[b - 1] -= 1
for (c, d) in CD:
	if u.same(c - 1, d - 1):
		ans[c - 1] -= 1
		ans[d - 1] -= 1
print(*ans)


(N, M, K) = map(int, input().split())
Friends = [set() for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	Friends[a].add(b)
	Friends[b].add(a)
Blocked = [set() for _ in range(N)]
for _ in range(K):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	Blocked[c].add(d)
	Blocked[d].add(c)
checked = set()
ans = [0] * N
for i in range(N):
	if i in checked:
		continue
	fg = set()
	stack = list(Friends[i])
	while stack:
		f = stack.pop()
		if f in checked:
			continue
		checked.add(f)
		fg.add(f)
		stack.extend(Friends[f])
	for f in fg:
		ans[f] += len(fg) - 1 - len(fg & (Friends[f] | Blocked[f]))
print(' '.join(map(str, ans)))


import sys
input = sys.stdin.readline

def connected_components(graph):
	seen = set()

	def component(n):
		nodes = set([n])
		while nodes:
			n = nodes.pop()
			seen.add(n)
			nodes |= graph[n] - seen
			yield n
	for n in graph:
		if n not in seen:
			yield component(n)
(n, m, k) = map(int, input().split())
friend = {i: set() for i in range(n)}
for i in range(m):
	(a, b) = map(int, input().split())
	friend[a - 1].add(b - 1)
	friend[b - 1].add(a - 1)
block = {i: set() for i in range(n)}
for i in range(k):
	(c, d) = map(int, input().split())
	block[c - 1].add(d - 1)
	block[d - 1].add(c - 1)
c = connected_components(friend)
fnum = [-1 for i in range(n)]
for graph in c:
	s = set(graph)
	for x in s:
		fnum[x] = len(s) - len(s & block[x]) - len(friend[x]) - 1
print(' '.join(map(str, fnum)))


from collections import deque
(n, m, k) = map(int, input().split())
friend = [list(map(int, input().split())) for _ in range(m)]
block = [list(map(int, input().split())) for _ in range(k)]
f = [set() for _ in range(n + 1)]
b = [set() for _ in range(n + 1)]
for (i, j) in friend:
	f[i].add(j)
	f[j].add(i)
for (i, j) in block:
	b[i].add(j)
	b[j].add(i)
stack = deque()
ans = [0] * (n + 1)
visited = [0] * (n + 1)
for i in range(1, n + 1):
	if visited[i]:
		continue
	link = {i}
	visited[i] = 1
	stack.append(i)
	while stack:
		n = stack.pop()
		for j in f[n]:
			if visited[j] == 0:
				stack.append(j)
				visited[j] = 1
				link.add(j)
	for i in link:
		ans[i] = len(link) - len(link & f[i]) - len(link & b[i]) - 1
print(*ans[1:])


from collections import deque
(n, m, k) = map(int, input().split())
fre = [[] for _ in range(n)]
blo = [[] for _ in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	fre[a - 1].append(b - 1)
	fre[b - 1].append(a - 1)
for i in range(k):
	(c, d) = map(int, input().split())
	blo[c - 1].append(d - 1)
	blo[d - 1].append(c - 1)
cnt = [0] * n
l = deque()
x = 1
dic = {}
for i in range(n):
	if cnt[i] == 0:
		l.append(i)
	while l:
		now = l.popleft()
		for to in fre[now]:
			if cnt[to] == 0:
				cnt[to] = x
				if x in dic:
					dic[x] += 1
				else:
					dic[x] = 1
				l.append(to)
	x += 1
for i in range(n):
	if dic == {}:
		print(0)
	else:
		k = len(fre[i])
		for b in blo[i]:
			if cnt[b] == cnt[i]:
				k += 1
		if cnt[i] in dic:
			print(dic[cnt[i]] - k - 1)
		else:
			print(0)


from collections import deque

def dfs(start):
	S = deque([start])
	link = {start}
	VL[start] = 1
	while S:
		node = S.pop()
		for f in AB[node]:
			if VL[f] == 1:
				continue
			link.add(f)
			S.append(f)
			VL[f] = 1
	for l in link:
		res[l] = len(link) - len(link & AB[l]) - len(link & CD[l]) - 1
(N, M, K) = map(int, input().split())
AB = [set() for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	AB[a].add(b)
	AB[b].add(a)
CD = [set() for _ in range(N)]
for _ in range(K):
	(c, d) = map(int, input().split())
	(c, d) = (c - 1, d - 1)
	CD[c].add(d)
	CD[d].add(c)
VL = [0] * N
res = [0] * N
for i in range(N):
	if VL[i] == 0:
		dfs(i)
print(*res)


import sys
(N, M, K) = map(int, input().split())
friends = [set() for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, sys.stdin.readline().split())
	friends[a - 1].add(b - 1)
	friends[b - 1].add(a - 1)
blocks = [set() for _ in range(N)]
for _ in range(K):
	(c, d) = map(int, sys.stdin.readline().split())
	blocks[c - 1].add(d - 1)
	blocks[d - 1].add(c - 1)
done = set()
chains = []
todo = []
for s in range(N):
	if s in done:
		continue
	chain = set()
	todo.append(s)
	while todo:
		i = todo.pop()
		for ni in friends[i]:
			if ni in done:
				continue
			done.add(ni)
			chain.add(ni)
			todo.append(ni)
	chains.append(chain)
ans = [0] * N
for chain in chains:
	for i in chain:
		blocks[i].intersection_update(chain)
		ans[i] = len(chain) - len(blocks[i]) - len(friends[i]) - 1
print(' '.join(map(str, ans)))


from collections import deque
(n, m, k) = map(int, input().split())
tomodati = [[] for i in range(n + 1)]
group = [0] * (n + 1)
group_cnt = [0] * (n + 1)
block = [0] * (n + 1)
tansaku = deque()
for i in range(m):
	(a, b) = map(int, input().split())
	tomodati[a].append(b)
	tomodati[b].append(a)
num = 1
for i in range(1, n + 1):
	if group[i] == 0:
		tansaku.append(i)
		group[i] = num
		group_cnt[num] += 1
	else:
		continue
	while len(tansaku) > 0:
		for j in tomodati[tansaku[0]]:
			if group[j] == 0:
				group[j] = num
				group_cnt[num] += 1
				tansaku.append(j)
		tansaku.popleft()
	num += 1
for i in range(k):
	(c, d) = map(int, input().split())
	if group[c] == group[d]:
		block[c] += 1
		block[d] += 1
ans = []
for i in range(1, n + 1):
	ans.append(group_cnt[group[i]] - len(tomodati[i]) - block[i] - 1)
print(*ans)


(n, m, k) = [int(i) for i in input().split()]
ro = [-1] * n
r = [0] * n
co = [1] * n
ab = []
for _ in range(m):
	(a, b) = [int(i) - 1 for i in input().split()]
	ab.append([a, b])
	while ro[a] != -1:
		a = ro[a]
	while ro[b] != -1:
		b = ro[b]
	if a != b:
		if r[a] > r[b]:
			ro[b] = a
			r[a] = max(r[a], r[b] + 1)
			co[a] += co[b]
		else:
			ro[a] = b
			r[b] = max(r[b], r[a] + 1)
			co[b] += co[a]
ans = []
for i in range(n):
	while ro[i] != -1:
		i = ro[i]
	ans.append(co[i] - 1)
for (a, b) in ab:
	ans[a] -= 1
	ans[b] -= 1
for _ in range(k):
	(c, d) = [int(i) - 1 for i in input().split()]
	(e, f) = (c, d)
	while ro[c] != -1:
		c = ro[c]
	while ro[d] != -1:
		d = ro[d]
	if c == d:
		ans[e] -= 1
		ans[f] -= 1
print(' '.join(list(map(str, ans))))


from collections import deque
(N, M, K) = map(int, input().split())
Sn = [0] * N
Sm = [0] * N
Sk = [0] * N
S = [0] * N
friend = [[] for _ in range(N)]
for i in range(M):
	(A, B) = map(int, input().split())
	Sm[A - 1] += 1
	Sm[B - 1] += 1
	friend[A - 1].append(B - 1)
	friend[B - 1].append(A - 1)
label = [-1] * N
for i in range(N):
	if label[i] == -1:
		label[i] = i
		F = deque(friend[i])
		while F:
			F0 = F.pop()
			if label[F0] == -1:
				Sn[i] += 1
				label[F0] = i
				for ii in friend[F0]:
					if label[ii] == -1:
						F.append(ii)
	else:
		Sn[i] = Sn[label[i]]
for i in range(K):
	(C, D) = map(int, input().split())
	if label[C - 1] == label[D - 1]:
		Sk[C - 1] += 1
		Sk[D - 1] += 1
for i in range(N):
	S[i] = str(Sn[i] - Sm[i] - Sk[i])
print(' '.join(S))


import sys
sys.setrecursionlimit(100000)

class UnionFind:

	def __init__(self, n):
		self.node = [-1] * n

	def unite(self, x, y):
		(_x, _y) = (self.find(x), self.find(y))
		if _x == _y:
			return False
		if abs(self.node[_x]) < abs(self.node[_y]):
			(self.node[_x], self.node[_y]) = (self.node[_y], self.node[_x])
		self.node[_x] += self.node[_y]
		self.node[_y] = _x
		return True

	def find(self, x):
		_val = self.node[x]
		if _val < 0:
			return x
		self.node[x] = self.find(_val)
		return self.node[x]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def size(self, x):
		return abs(self.node[self.find(x)])

	def __str__(self):
		return str(self.node)
(N, M, K) = map(int, input().split())
uf = UnionFind(N)
friend = [0] * N
block = [[] for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	uf.unite(a, b)
	(friend[a], friend[b]) = (friend[a] + 1, friend[b] + 1)
for _ in range(K):
	(c, d) = map(int, input().split())
	(c, d) = (c - 1, d - 1)
	block[c].append(d)
	block[d].append(c)
for i in range(N):
	ans = uf.size(i) - friend[i] - 1
	for j in block[i]:
		if uf.same(i, j):
			ans -= 1
	print('{} '.format(ans), end='')
print('')


(n, m, k) = map(int, input().split())
w = [i for i in range(n + 1)]
s = [1] * (n + 1)
g = [list(map(int, input().split())) for i in range(m)]

def root(x):
	if w[x] == x:
		return x
	x = w[x]
	return root(w[x])

def unite(x, y):
	x = root(x)
	y = root(y)
	if x != y:
		if s[x] < s[y]:
			w[x] = y
			s[y] += s[x]
		else:
			w[y] = x
			s[x] += s[y]
for i in range(m):
	(a, b) = (g[i][0], g[i][1])
	unite(a, b)
for i in range(1, n + 1):
	w[i] = root(i)
	s[i] = s[w[i]]
for i in range(m):
	s[g[i][0]] -= 1
	s[g[i][1]] -= 1
for i in range(k):
	(a, b) = map(int, input().split())
	if w[a] == w[b]:
		s[a] -= 1
		s[b] -= 1
for i in range(1, n + 1):
	s[i] -= 1
print(*s[1:])


from sys import setrecursionlimit
setrecursionlimit(2 * 10 ** 9)
(N, M, K) = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
CD = [list(map(int, input().split())) for _ in range(K)]
f_G = [[] for _ in range(N)]
for (a, b) in AB:
	(a, b) = (a - 1, b - 1)
	f_G[a].append(b)
	f_G[b].append(a)
b_G = [[] for _ in range(N)]
for (c, d) in CD:
	(c, d) = (c - 1, d - 1)
	b_G[c].append(d)
	b_G[d].append(c)

def dfs(v):
	if visited[v]:
		return
	visited[v] = True
	for nv in f_G[v]:
		s.add(nv)
		dfs(nv)
ans = [0] * N
visited = [False] * N
for i in range(N):
	if not visited[i]:
		s = set()
		dfs(i)
		l = len(s)
		for u in s:
			ans[u] = l - 1
			ans[u] -= len(set(f_G[u]) & s)
			ans[u] -= len(set(b_G[u]) & s)
print(*ans)


(n, m, k) = map(int, input().split())

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def unite(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return False
	else:
		if par[x] > par[y]:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x
		return True

def same(x, y):
	return find(x) == find(y)

def size(x):
	return -par[find(x)]
par = [-1] * n
friend = [0] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	unite(a - 1, b - 1)
	friend[a - 1] += 1
	friend[b - 1] += 1
block = [[] for _ in range(n)]
for _ in range(k):
	(c, d) = map(int, input().split())
	block[c - 1].append(d - 1)
	block[d - 1].append(c - 1)
for i in range(n):
	ans = size(i) - friend[i] - 1
	for j in block[i]:
		if same(i, j):
			ans -= 1
	print(ans, end=' ')


from collections import defaultdict, deque, Counter
(N, M, K) = map(int, input().split())
friend = defaultdict(list)
for i in range(M):
	(a, b) = list(map(int, input().split()))
	friend[a].append(b)
	friend[b].append(a)
block = [list(map(int, input().split())) for i in range(K)]
IDs = [-1] * (N + 1)
ID = 0
for i in range(1, N + 1):
	if IDs[i] != -1:
		continue
	dq = deque([i])
	while dq:
		v = dq.popleft()
		IDs[v] = ID
		for nv in friend[v]:
			if IDs[nv] == -1:
				dq.append(nv)
	ID += 1
group = Counter(IDs)
ans = []
for i in range(1, N + 1):
	temp = group[IDs[i]] - len(friend[i]) - 1
	ans.append(temp)
for (c, d) in block:
	if IDs[c] == IDs[d]:
		ans[c - 1] -= 1
		ans[d - 1] -= 1
print(*ans)


from collections import Counter
(N, M, K) = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
CD = [list(map(int, input().split())) for _ in range(K)]
friend_g = [set() for i in range(N)]
for (a, b) in AB:
	(a, b) = (a - 1, b - 1)
	friend_g[a].add(b)
	friend_g[b].add(a)
friend_count = [len(s) for s in friend_g]
g_nums = [-1] * N
current_g_num = 0
for i in range(N):
	if g_nums[i] == -1:
		g_nums[i] = current_g_num
		q = [i]
		while q:
			t = q.pop()
			for friend in friend_g[t]:
				if g_nums[friend] == -1:
					g_nums[friend] = current_g_num
					q.append(friend)
		current_g_num += 1
block_count = [0] * N
for (c, d) in CD:
	(c, d) = (c - 1, d - 1)
	if g_nums[c] == g_nums[d]:
		block_count[c] += 1
		block_count[d] += 1
g_nums_counter = Counter(g_nums)
print(*(g_nums_counter[g_nums[i]] - friend_count[i] - block_count[i] - 1 for i in range(N)))


from sys import setrecursionlimit

def find(parent, i):
	t = parent[i]
	if t < 0:
		return i
	t = find(parent, t)
	parent[i] = t
	return t

def unite(parent, i, j):
	i = find(parent, i)
	j = find(parent, j)
	if i == j:
		return
	parent[j] += parent[i]
	parent[i] = j
setrecursionlimit(10 ** 5)
(n, m, k) = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(k)]
parent = [-1] * n
friends = [[] for _ in range(n)]
for (A, B) in ab:
	unite(parent, A - 1, B - 1)
	friends[A - 1].append(B - 1)
	friends[B - 1].append(A - 1)
blocks = [[] for _ in range(n)]
for (C, D) in cd:
	blocks[C - 1].append(D - 1)
	blocks[D - 1].append(C - 1)
result = []
for i in range(n):
	p = find(parent, i)
	t = -parent[p] - 1
	t -= len(friends[i])
	for b in blocks[i]:
		if p == find(parent, b):
			t -= 1
	result.append(t)
print(*result)


(N, M, K) = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
CD = [list(map(int, input().split())) for _ in range(K)]
root = [i for i in range(N + 1)]
size = [1] * (N + 1)

def find(x):
	y = root[x]
	if x == y:
		return x
	else:
		z = find(y)
		root[x] = z
		return z

def union(x, y):
	rx = find(x)
	ry = find(y)
	sx = size[rx]
	sy = size[ry]
	if rx == ry:
		return 0
	else:
		if sx >= sy:
			root[ry] = rx
			size[rx] = sx + sy
		else:
			root[rx] = ry
			size[ry] = sx + sy
		return sx * sy
for (a, b) in AB:
	union(a, b)
answer = []
for i in range(N + 1):
	answer.append(size[find(i)] - 1)
for (a, b) in AB:
	if find(a) == find(b):
		answer[a] -= 1
		answer[b] -= 1
for (c, d) in CD:
	if find(c) == find(d):
		answer[c] -= 1
		answer[d] -= 1
print(*answer[1:])


(n, m, k) = map(int, input().split())
frag = list(range(n + 1))

def takefrag(p):
	stock = []
	while frag[frag[p]] != frag[p]:
		stock.append(p)
		p = frag[p]
	p = frag[p]
	for i in stock:
		frag[i] = p
	return p
ans = [-1] * (n + 1)
for i in range(m):
	(a, b) = map(int, input().split())
	ans[a] -= 1
	ans[b] -= 1
	(a, b) = (takefrag(a), takefrag(b))
	(a, b) = (min(a, b), max(a, b))
	frag[a] = b
fragteam = [0] * (n + 1)
for i in range(n + 1):
	frag[i] = takefrag(i)
	fragteam[frag[i]] += 1
for i in range(k):
	(a, b) = map(int, input().split())
	if frag[a] == frag[b]:
		ans[a] -= 1
		ans[b] -= 1
for i in range(n + 1):
	ans[i] += fragteam[frag[i]]
for i in ans[1:-1]:
	print(i, end=' ')
print(ans[-1])


(n, m, k) = map(int, input().split())
par = [-1] * n
num = [0] * n

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def unite(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return False
	else:
		if par[x] > par[y]:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x
		return True

def same(x, y):
	return find(x) == find(y)

def size(x):
	return -par[find(x)]
for i in range(m):
	(a, b) = map(int, input().split())
	unite(a - 1, b - 1)
	num[a - 1] += 1
	num[b - 1] += 1
edge = [[] for i in range(n)]
for i in range(k):
	(c, d) = map(int, input().split())
	edge[c - 1].append(d - 1)
	edge[d - 1].append(c - 1)
for i in range(n):
	cnt = size(i) - num[i] - 1
	for e in edge[i]:
		if same(e, i):
			cnt -= 1
	print(cnt, end=' ')


from sys import setrecursionlimit
setrecursionlimit(10 ** 6)
(n, m, k) = map(int, input().split())
fr = [set() for _ in range(n)]
bl = [set() for _ in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	fr[a - 1].add(b - 1)
	fr[b - 1].add(a - 1)
for i in range(k):
	(c, d) = map(int, input().split())
	bl[c - 1].add(d - 1)
	bl[d - 1].add(c - 1)

def dfs(v, temp):
	visited[v] = True
	temp.add(v)
	for i in fr[v]:
		if visited[i] == False:
			temp = dfs(i, temp)
	return temp
visited = [False] * n
cc = [0] * n
for v in range(n):
	if visited[v] == False:
		c = dfs(v, set())
		for i in c:
			cc[i] = c
ans = []
for i in range(n):
	aa = len(cc[i]) - len(cc[i] & fr[i]) - len(cc[i] & bl[i]) - 1
	ans.append(aa)
print(*ans)


class UnionFind:

	def __init__(self, N):
		self.N = N
		self.parent = [-1] * N

	def root(self, i):
		if self.parent[i] < 0:
			return i
		r = self.root(self.parent[i])
		self.parent[i] = r
		return r

	def unite(self, i, j):
		i = self.root(i)
		j = self.root(j)
		if i == j:
			return
		if i > j:
			(i, j) = (j, i)
		self.parent[i] += self.parent[j]
		self.parent[j] = i

	def same(self, i, j):
		return self.root(i) == self.root(j)

	def size(self, i):
		return -self.parent[self.root(i)]

	def roots(self):
		return [self.root(i) for i in range(self.N)]

	def groupcount(self):
		return len(set(self.roots()))
(N, M, K) = map(int, input().split())
notfriend = [set() for _ in range(N)]
forest = UnionFind(N)
for i in range(M):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	notfriend[a].add(b)
	notfriend[b].add(a)
	forest.unite(a, b)
for i in range(K):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	if forest.same(a, b):
		notfriend[a].add(b)
		notfriend[b].add(a)
ans = ' '.join([str(forest.size(i) - 1 - len(notfriend[i])) for i in range(N)])
print(ans)


(n, m, k) = map(int, input().split())
par = [-1] * n
num = [0] * n

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def union(x, y):
	(p, q) = (find(x), find(y))
	if p == q:
		return
	if p > q:
		(p, q) = (q, p)
	par[p] += par[q]
	par[q] = p

def size(x):
	return -par[find(x)]

def same(x, y):
	return find(x) == find(y)
for i in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	union(a, b)
	num[a] += 1
	num[b] += 1
for i in range(k):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	if same(c, d):
		num[c] += 1
		num[d] += 1
for i in range(n):
	print(size(i) - 1 - num[i], end=' ')


import sys
sys.setrecursionlimit(10 ** 5)

def DFS(i, g):
	if i not in done:
		done.add(i)
		circle.add(i)
		g_list[i] = g
		for f in F[i]:
			DFS(f, g)
	else:
		return
(N, M, K) = map(int, input().split())
F = [[] for _ in range(N)]
B = [[] for _ in range(N)]
for f in range(M):
	(f1, f2) = map(int, input().split())
	F[f1 - 1].append(f2 - 1)
	F[f2 - 1].append(f1 - 1)
for b in range(K):
	(b1, b2) = map(int, input().split())
	B[b1 - 1].append(b2 - 1)
	B[b2 - 1].append(b1 - 1)
Group = []
circle = set()
done = set()
g_list = [0 for _ in range(N)]
g = 0
for i in range(N):
	if i not in done:
		DFS(i, g)
		Group.append(circle)
		circle = set()
		g += 1
ans = [-1 for _ in range(N)]
for i in range(N):
	G = g_list[i]
	ans[i] += len(Group[G])
	for fr in F[i]:
		if fr in Group[G]:
			ans[i] -= 1
	for bl in B[i]:
		if bl in Group[G]:
			ans[i] -= 1
print(*ans)


import sys
import math
import copy
import queue
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
f = [[] for _ in range(n + 1)]
b = [[] for _ in range(n + 1)]
for _ in range(m):
	(x, y) = map(int, input().split())
	f[x].append(y)
	f[y].append(x)
for _ in range(k):
	(x, y) = map(int, input().split())
	b[x].append(y)
	b[y].append(x)
g = [0 for _ in range(n + 1)]
g_cnt = [0]
g_no = 0
for i in range(1, n + 1):
	if g[i] > 0:
		continue
	g_no += 1
	q = queue.Queue()
	q.put(i)
	cnt = 0
	while not q.empty():
		g[i] = g_no
		node = q.get()
		cnt += 1
		for n_node in f[node]:
			if g[n_node] == 0:
				q.put(n_node)
				g[n_node] = g_no
	g_cnt.append(cnt)
for i in range(1, n + 1):
	block = 0
	for x in b[i]:
		block += g[i] == g[x]
	print(g_cnt[g[i]] - len(f[i]) - block - 1, end=' ')
print()


(n, m, k) = map(int, input().split())
edge = [[] for i in range(n + 1)]
for i in range(m):
	(a, b) = map(int, input().split())
	edge[a].append(b)
	edge[b].append(a)
blist = [[] for i in range(n + 1)]
for i in range(k):
	(a, b) = map(int, input().split())
	blist[a].append(b)
	blist[b].append(a)
ans = [-1] * (n + 1)
for i in range(1, n + 1):
	if ans[i] == -1:
		s = set([i])
		q = [i]
		while q:
			for j in edge[q.pop()]:
				if j not in s:
					s.add(j)
					q.append(j)
		for j in s:
			tmp = len(s) - len(edge[j]) - 1
			for k in blist[j]:
				if k in s:
					tmp -= 1
			ans[j] = tmp
print(' '.join(map(str, ans[1:])))


import collections
(N, M, K) = map(int, input().split())
friend = [[] for i in range(N)]
block = [[] for i in range(N)]
graph = [-1] * N
for i in range(M):
	(a, b) = map(int, input().split())
	friend[a - 1].append(b - 1)
	friend[b - 1].append(a - 1)
for i in range(K):
	(c, d) = map(int, input().split())
	block[c - 1].append(d - 1)
	block[d - 1].append(c - 1)
used = [True] * N
for i in range(N):
	if used[i]:
		q = [i]
		used[i] = False
		graph[i] = i
		while q:
			now = q.pop()
			for j in friend[now]:
				if used[j]:
					graph[j] = graph[now]
					q.append(j)
					used[j] = False
gg = dict(collections.Counter(graph))
for i in range(N):
	nn = graph[i]
	size = gg[nn]
	ans = size - 1
	for j in friend[i]:
		if nn == graph[j]:
			ans -= 1
	for j in block[i]:
		if nn == graph[j]:
			ans -= 1
	print(ans, end=' ')


def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def unite(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return False
	else:
		if par[x] > par[y]:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x
		return True

def same(x, y):
	return find(x) == find(y)

def size(x):
	return -par[find(x)]
(n, m, k) = [int(i) for i in input().split()]
par = [-1] * n
ans = [-1] * n
import sys
input = sys.stdin.readline
for _ in range(m):
	(a, b) = [int(j) for j in input().split()]
	unite(a - 1, b - 1)
	ans[a - 1] -= 1
	ans[b - 1] -= 1
for _ in range(k):
	(c, d) = [int(i) for i in input().split()]
	if same(c - 1, d - 1):
		ans[c - 1] -= 1
		ans[d - 1] -= 1
for i in range(n):
	ans[i] += size(i)
ans = list(map(str, ans))
print(' '.join(ans))


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
(n, m, k) = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
cd = [list(map(int, input().split())) for i in range(k)]
uf = [-1] * n

def root(x):
	if uf[x] < 0:
		return x
	uf[x] = root(uf[x])
	return uf[x]

def unite(x, y):
	(rx, ry) = (root(x), root(y))
	if rx == ry:
		return False
	if uf[rx] > uf[ry]:
		(rx, ry) = (ry, rx)
	uf[rx] += uf[ry]
	uf[ry] = rx
	return True
hop1 = [0] * n
dislike = [0] * n
for (a, b) in ab:
	(a, b) = (a - 1, b - 1)
	unite(a, b)
	hop1[a] += 1
	hop1[b] += 1
for (c, d) in cd:
	(c, d) = (c - 1, d - 1)
	if root(c) == root(d):
		dislike[c] += 1
		dislike[d] += 1
ans = [-uf[root(i)] - hop1[i] - dislike[i] - 1 for i in range(n)]
print(*ans)


from collections import deque
(n, m, k) = map(int, input().split())
a = [list(map(lambda x: int(x) - 1, input().split())) for i in range(m)]
c = [list(map(lambda x: int(x) - 1, input().split())) for i in range(k)]
mp = [set() for _ in range(n)]
bl = [set() for _ in range(n)]
for (af, bf) in a:
	mp[af].add(bf)
	mp[bf].add(af)
for (cf, df) in c:
	bl[cf].add(df)
	bl[df].add(cf)
sz = [0] * n
for i in range(n):
	if sz[i] > 0:
		continue
	d = deque()
	reach = {i}
	d.append(i)
	while d:
		s = d.pop()
		for g in mp[s]:
			if g in reach:
				continue
			else:
				reach.add(g)
				d.append(g)
	for j in reach:
		sz[j] = len(reach)
	for k in reach:
		for j in bl[k]:
			if j in reach:
				sz[k] -= 1
for i in range(n):
	sz[i] -= len(mp[i]) + 1
print(*sz)


(N, M, K) = list(map(int, input().split()))
root = [i for i in range(N)]
height = [1 for i in range(N)]
l = [set() for i in range(N)]
mem = [0] * N

def find(n):
	f = n
	while n != root[n]:
		n = root[n]
	root[f] = n
	return n

def union(a, b):
	A = find(a)
	B = find(b)
	if A == B:
		return
	elif height[A] < height[B]:
		height[B] += height[A]
		height[A] = 0
		root[A] = B
	else:
		root[B] = A
		height[A] += height[B]
		height[B] = 0

def same(a, b):
	A = find(a)
	B = find(b)
	if A == B:
		l[a].add(b)
		l[b].add(a)
for i in range(M):
	(a, b) = list(map(int, input().split()))
	a -= 1
	b -= 1
	l[a].add(b)
	l[b].add(a)
	union(a, b)
for j in range(K):
	(a, b) = list(map(int, input().split()))
	a -= 1
	b -= 1
	same(a, b)
for i in range(N):
	print(height[find(i)] - len(l[i]) - 1, end=' ')


from collections import defaultdict
from sys import setrecursionlimit
setrecursionlimit(10 ** 6)
(N, M, K) = map(int, input().split())
F = [list(map(int, input().split())) for _ in range(M)]
B = [list(map(int, input().split())) for _ in range(K)]

class UFTree:

	def __init__(self, n):
		self.length = n + 1
		self.roots = list(range(self.length))

	def union(self, a, b):
		r = self.find(a)
		s = self.find(b)
		self.roots[s] = r

	def find(self, a):
		r = self.roots[a]
		if r == a:
			return a
		r = self.find(r)
		self.roots[a] = r
		return r

	def findall(self):
		for i in range(self.length):
			self.find(i)

	def setli(self):
		self.findall()
		d = defaultdict(set)
		for (i, r) in enumerate(self.roots):
			if i:
				d[r].add(i)
		return list(d.values())

	def sameroot(self, a, b):
		r = self.find(a)
		s = self.find(b)
		return r == s
t = UFTree(N)
for (a, b) in F:
	t.union(a, b)
s = [0] * (N + 1)
for (a, b) in F:
	s[a] -= 1
	s[b] -= 1
for (c, d) in B:
	if t.sameroot(c, d):
		s[c] -= 1
		s[d] -= 1
for u in t.setli():
	l = len(u)
	for i in u:
		s[i] += l - 1
print(*s[1:])


import sys
sys.setrecursionlimit(6500)
(N, M, K) = map(int, input().split())
F = [[] for _ in range(N)]
B = [[] for _ in range(N)]
d = [-1] * N

def find(n):
	if d[n] < 0:
		return n
	else:
		d[n] = find(d[n])
		return d[n]

def union(a, b):
	a = find(a)
	b = find(b)
	if a == b:
		return False
	if d[a] <= d[b]:
		d[a] += d[b]
		d[b] = a
	else:
		d[b] += d[a]
		d[a] = b
	return True

def same(a, b):
	if find(a) == find(b):
		return True
	else:
		return False
for i in range(M):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	union(a, b)
	F[a].append(b)
	F[b].append(a)
for i in range(K):
	(a, b) = map(int, input().split())
	B[a - 1].append(b - 1)
	B[b - 1].append(a - 1)
ans = [0] * N
for i in range(N):
	p = find(i)
	ans[i] = -d[p] - len(F[i]) - 1
	for b in B[i]:
		if same(i, b):
			ans[i] -= 1
for i in ans:
	print(str(i), end=' ')


from collections import deque, Counter
(n, m, k) = map(int, input().split())
G = [[] for _ in range(n)]
exc = [0] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	G[a].append(b)
	G[b].append(a)
	exc[a] += 1
	exc[b] += 1
stk = deque()
grp = [-1] * n
grpnum = 0

def dfs(s, g):
	stk.append(s)
	grp[s] = g
	while stk:
		cur = stk.pop()
		for nxt in G[cur]:
			if grp[nxt] != -1:
				continue
			grp[nxt] = g
			stk.append(nxt)
for i in range(n):
	if grp[i] != -1:
		continue
	dfs(i, grpnum)
	grpnum += 1
cnt = Counter(grp)
for _ in range(k):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	if grp[c] == grp[d]:
		exc[c] += 1
		exc[d] += 1
ans = [cnt[grp[i]] - exc[i] - 1 for i in range(n)]
print(*ans)


class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, v):
		if self.parents[v] < 0:
			return v
		else:
			self.parents[v] = self.find(self.parents[v])
			return self.parents[v]

	def unite(self, u, v):
		u = self.find(u)
		v = self.find(v)
		if u == v:
			return
		if self.parents[u] > self.parents[v]:
			(u, v) = (v, u)
		self.parents[u] += self.parents[v]
		self.parents[v] = u

	def size(self, v):
		return -self.parents[self.find(v)]

	def same(self, u, v):
		return self.find(u) == self.find(v)
(N, M, K) = map(int, input().split())
uf = UnionFind(N + 1)
F = [0] * (N + 1)
B = [0] * (N + 1)
for _ in range(M):
	(a, b) = map(int, input().split())
	uf.unite(a, b)
	F[a] += 1
	F[b] += 1
for _ in range(K):
	(c, d) = map(int, input().split())
	if uf.same(c, d):
		B[c] += 1
		B[d] += 1
for i in range(1, N + 1):
	ans = uf.size(i) - F[i] - B[i] - 1
	print(ans, end=' ')
print()


from sys import setrecursionlimit
setrecursionlimit(1 << 30)
(nv, ne, nBad) = map(int, input().split())
g = [[] for _ in range(nv)]
for _ in range(ne):
	(u, v) = map(lambda x: int(x) - 1, input().split())
	g[u].append(v)
	g[v].append(u)
a = [tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(nBad)]

def dfs(v):
	id[v] = cur
	comps[-1].append(v)
	for to in g[v]:
		if id[to] == None:
			dfs(to)
id = [None] * nv
cur = 0
comps = []
for v in range(nv):
	if id[v] == None:
		comps.append([])
		dfs(v)
		cur += 1
bad = [0] * nv
for (u, v) in a:
	if id[u] == id[v]:
		bad[u] += 1
		bad[v] += 1
ret = [None] * nv
for v in range(nv):
	ret[v] = len(comps[id[v]]) - 1 - len(g[v]) - bad[v]
print(' '.join(map(str, ret)))


from collections import Counter

def main():
	(n, m, k) = [int(s) for s in input().strip().split()]
	adj = [[] for _ in range(n)]
	for _ in range(m):
		(a, b) = [int(s) for s in input().strip().split()]
		adj[a - 1].append(b - 1)
		adj[b - 1].append(a - 1)
	groups = [-1] * n
	for i in range(n):
		if groups[i] < 0:
			groups[i] = i
			q = [i]
			for j in q:
				for v in adj[j]:
					if groups[v] < 0:
						groups[v] = i
						q.append(v)
	cnt = Counter(groups)
	result = [cnt[groups[i]] - len(adj[i]) - 1 for i in range(n)]
	for _ in range(k):
		(c, d) = [int(s) for s in input().strip().split()]
		if groups[c - 1] == groups[d - 1]:
			result[c - 1] -= 1
			result[d - 1] -= 1
	print(' '.join((str(x) for x in result)))
main()


(n, m, k) = map(int, input().split())
par = [i for i in range(n)]
deep = [1] * n
size = [1] * n

def find(x):
	if par[x] == x:
		return x
	else:
		return find(par[x])

def unite(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return
	if deep[x] < deep[y]:
		par[x] = y
		size[y] += size[x]
	else:
		par[y] = x
		size[x] += size[y]
		if deep[x] == deep[y]:
			deep[x] += 1

def same(x, y):
	return find(x) == find(y)

def group_count(x):
	return size[find(x)]
es = [[] for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	es[a - 1].append(b)
	es[b - 1].append(a)
	unite(a - 1, b - 1)
cnt = [1] * n
for i in range(n):
	cnt[i] = group_count(i)
check = [0] * n
for j in range(k):
	(c, d) = map(int, input().split())
	if same(c - 1, d - 1):
		check[c - 1] += 1
		check[d - 1] += 1
for i in range(n):
	print(cnt[i] - 1 - len(es[i]) - check[i], end=' ')


(N, M, K) = map(int, input().split())
ans = [0] * (N + 1)
child = {i: [] for i in range(1, N + 1)}
isChecked = [0] * (N + 1)
isBlocked = [set() for _ in range(N + 1)]
for _ in range(M):
	(a, b) = map(int, input().split())
	child[a].append(b)
	child[b].append(a)
for _ in range(K):
	(c, d) = map(int, input().split())
	isBlocked[c].add(d)
	isBlocked[d].add(c)
for i in range(1, N + 1):
	if isChecked[i]:
		continue
	isChecked[i] = 1
	x = set([i])
	ch = child[i].copy()
	while ch:
		c = ch.pop()
		if isChecked[c]:
			continue
		isChecked[c] = 1
		x.add(c)
		ch.extend(child[c])
	for j in x:
		ans[j] = len(x) - 1 - len(child[j]) - len(x & isBlocked[j])
print(*ans[1:])


def makeRelation():
	visited = [False] * (N + 1)
	g = 0
	for n in range(1, N + 1):
		if visited[n]:
			continue
		q = {n}
		D.append(set())
		while q:
			j = q.pop()
			for i in F[j]:
				if not visited[i]:
					visited[i] = True
					q.add(i)
					D[g] |= {i}
		g += 1

def main():
	makeRelation()
	for g in D:
		for d in g:
			ans[d] = len(g) - len(F[d]) - len(g & B[d]) - 1
	print(*ans[1:])
(N, M, K) = map(int, input().split())
F = [set() for n in range(N + 1)]
AB = [list(map(int, input().split())) for m in range(M)]
for (a, b) in AB:
	F[a].add(b)
	F[b].add(a)
B = [set() for n in range(N + 1)]
CD = [list(map(int, input().split())) for k in range(K)]
for (c, d) in CD:
	B[c].add(d)
	B[d].add(c)
D = []
ans = [0] * (N + 1)
main()


def init(n):
	par = list(range(n))
	size = [1] * n
	return (par, size)

def root(x):
	if par[x] == x:
		return x
	else:
		par[x] = root(par[x])
		return par[x]

def same(x, y):
	return root(x) == root(y)

def unite(x, y):
	x = root(x)
	y = root(y)
	if x == y:
		return
	if size[x] < size[y]:
		par[x] = y
		size[y] += size[x]
	else:
		par[y] = x
		size[x] += size[y]
(N, M, K) = map(int, input().split())
(par, size) = init(N + 1)
non_candidates = [1] * (N + 1)
for i in range(M):
	(a, b) = map(int, input().split())
	unite(a, b)
	non_candidates[a] += 1
	non_candidates[b] += 1
for i in range(K):
	(c, d) = map(int, input().split())
	if same(c, d):
		non_candidates[c] += 1
		non_candidates[d] += 1
for i in range(1, N + 1):
	print(size[root(i)] - non_candidates[i], end=' ')


(n, m, k) = map(int, input().split())
fri = [0 for _ in range(n)]
blo = [0 for _ in range(n)]
par = [i for i in range(n)]
size = [1 for _ in range(n)]
rank = [0 for _ in range(n)]

def find(x):
	if par[x] == x:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def merge(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return
	if rank[x] > rank[y]:
		par[y] = x
		size[x] += size[y]
	else:
		par[x] = y
		size[y] += size[x]
		if rank[x] == rank[y]:
			rank[y] += 1

def same(x, y):
	return find(x) == find(y)
for _ in range(m):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	merge(a, b)
	fri[a] += 1
	fri[b] += 1
for _ in range(k):
	(c, d) = map(int, input().split())
	(c, d) = (c - 1, d - 1)
	if same(c, d):
		blo[c] += 1
		blo[d] += 1
ans = [size[find(i)] - fri[i] - blo[i] - 1 for i in range(n)]
print(*ans)


class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parent = [i for i in range(n)]
		self.rank = [1] * n
		self.size = [1] * n

	def find(self, x):
		if self.parent[x] == x:
			return x
		else:
			self.parent[x] = self.find(self.parent[x])
			return self.parent[x]

	def unite(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x != y:
			if self.rank[x] < self.rank[y]:
				self.parent[x] = y
				self.size[y] += self.size[x]
			else:
				self.parent[y] = x
				self.size[x] += self.size[y]
				if self.rank[x] == self.rank[y]:
					self.rank[x] += 1

	def is_same(self, x, y):
		return self.find(x) == self.find(y)

	def group_size(self, x):
		return self.size[self.find(x)]
(n, m, k) = map(int, input().split())
a = [0] * m
b = [0] * m
c = [0] * k
d = [0] * k
x = [0] * n
direct = [[] for _ in range(n)]
uf = UnionFind(n)
for i in range(m):
	(a[i], b[i]) = map(int, input().split())
	a[i] -= 1
	b[i] -= 1
	direct[a[i]].append(b[i])
	direct[b[i]].append(a[i])
	uf.unite(a[i], b[i])
for i in range(k):
	(c[i], d[i]) = map(int, input().split())
	c[i] -= 1
	d[i] -= 1
	if uf.is_same(c[i], d[i]):
		direct[c[i]].append(d[i])
		direct[d[i]].append(c[i])
for i in range(n):
	x[i] = uf.group_size(i) - len(direct[i]) - 1
print(*x)


from collections import defaultdict

class UnionFind:

	def __init__(self, n=0):
		self.d = [-1] * n

	def find(self, x):
		if self.d[x] < 0:
			return x
		self.d[x] = self.find(self.d[x])
		return self.d[x]

	def unite(self, x, y):
		(x, y) = (self.find(x), self.find(y))
		if x == y:
			return False
		if self.d[x] > self.d[y]:
			(x, y) = (y, x)
		self.d[x] += self.d[y]
		self.d[y] = x
		return True

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def size(self, x):
		return -self.d[self.find(x)]
(N, M, K) = map(int, input().split())
uf = UnionFind(N + 1)
n_friends = defaultdict(int)
for i in range(M):
	(a, b) = map(int, input().split())
	uf.unite(a, b)
	n_friends[a] += 1
	n_friends[b] += 1
ans = [uf.size(i) - n_friends[i] - 1 for i in range(N + 1)]
for i in range(K):
	(c, d) = map(int, input().split())
	if uf.same(c, d):
		ans[c] -= 1
		ans[d] -= 1
print(*ans[1:])


class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join(('{}: {}'.format(r, self.members(r)) for r in self.roots()))
(n, m, k) = map(int, input().split())
fr = [0] * n
uf_fr = UnionFind(n)
for i in range(m):
	(a, b) = map(int, input().split())
	uf_fr.union(a - 1, b - 1)
	fr[a - 1] += 1
	fr[b - 1] += 1
for i in range(k):
	(c, d) = map(int, input().split())
	if uf_fr.find(c - 1) == uf_fr.find(d - 1):
		fr[c - 1] += 1
		fr[d - 1] += 1
ans_list = []
for i in range(n):
	ans_list.append(uf_fr.size(i) - fr[i] - 1)
print(*ans_list)


import sys
input = sys.stdin.readline

def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def union(x, y):
	x = find(x)
	y = find(y)
	if x == y:
		return
	if par[x] > par[y]:
		(x, y) = (y, x)
	par[x] += par[y]
	par[y] = x

def same(x, y):
	return find(x) == find(y)

def size(x):
	return -par[find(x)]
(n, m, k) = map(int, input().split())
par = [-1] * n
friend = [0] * n
for _ in range(m):
	(a, b) = map(int, input().split())
	union(a - 1, b - 1)
	friend[a - 1] += 1
	friend[b - 1] += 1
block = [[] for _ in range(n)]
for _ in range(k):
	(c, d) = map(int, input().split())
	block[c - 1].append(d - 1)
	block[d - 1].append(c - 1)
for i in range(n):
	ans = size(i) - friend[i] - 1
	for j in block[i]:
		if same(i, j):
			ans -= 1
	print(ans, end=' ')


class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return set([i for i in range(self.n) if self.find(i) == root])

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())
(n, m, k) = list(map(int, input().split()))
friend_un = UnionFind(n)
lst = [0] * n
for _ in range(m):
	(a, b) = list(map(int, input().split()))
	a -= 1
	b -= 1
	friend_un.union(a, b)
	lst[a] -= 1
	lst[b] -= 1
for _ in range(k):
	(a, b) = list(map(int, input().split()))
	a -= 1
	b -= 1
	if friend_un.same(a, b):
		lst[a] -= 1
		lst[b] -= 1
for i in range(n):
	lst[i] += friend_un.size(i) - 1
print(' '.join([str(i) for i in lst]))


(N, M, K) = map(int, input().split())
friends = [set() for _ in range(N)]
for _ in range(M):
	(a, b) = map(lambda x: int(x) - 1, input().split())
	friends[a].add(b)
	friends[b].add(a)
blocks = [set() for _ in range(N)]
for _ in range(K):
	(c, d) = map(lambda x: int(x) - 1, input().split())
	blocks[c].add(d)
	blocks[d].add(c)
ans = [0] * N
visited = [False] * N
for i in range(N):
	if visited[i]:
		continue
	visited[i] = True
	d = [i]
	check = {i}
	while len(d):
		tmp = d.pop()
		for k in friends[tmp]:
			if visited[k]:
				continue
			d.append(k)
			visited[k] = True
			check.add(k)
	for j in check:
		ans[j] += len(check) - len(friends[j] & check) - len(blocks[j] & check) - 1
print(*ans)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
from collections import Counter
(n, m, k) = map(int, input().split())
graph1 = [[] for _ in range(n)]
for _ in range(m):
	(a, b) = [int(x) - 1 for x in input().split()]
	graph1[a].append(b)
	graph1[b].append(a)
graph2 = [[] for _ in range(n)]
for _ in range(k):
	(c, d) = [int(x) - 1 for x in input().split()]
	graph2[c].append(d)
	graph2[d].append(c)

def dfs(now):
	X[now] = x
	for next in graph1[now]:
		if X[next]:
			continue
		dfs(next)
X = [0] * n
x = 1
for i in range(n):
	if X[i]:
		continue
	dfs(i)
	x += 1
cnt = Counter(X)
ans = []
for i in range(n):
	x = X[i]
	tmp = cnt[x] - 1
	tmp -= len(graph1[i])
	tmp -= sum((X[j] == x for j in graph2[i]))
	ans.append(tmp)
print(*ans)


from collections import deque
(n, m, k) = map(int, input().split())
adj = {a: [] for a in range(1, n + 1)}
for i in range(m):
	(a, b) = map(int, input().split())
	adj[a].append(b)
	adj[b].append(a)
connOf = {}
for a in range(1, n + 1):
	if a in connOf:
		continue
	conn = set()
	queue = deque()
	queue.append(a)
	while len(queue) > 0:
		p = queue.popleft()
		if p not in conn:
			conn.add(p)
			connOf[p] = conn
			queue.extend(adj[p])
block = {a: [] for a in range(1, n + 1)}
for i in range(k):
	(c, d) = map(int, input().split())
	if c in connOf[d]:
		block[c].append(d)
		block[d].append(c)
nCandidate = [len(connOf[a]) - 1 - len(adj[a]) - len(block[a]) for a in range(1, n + 1)]
print(' '.join(map(str, nCandidate)))


import sys
sys.setrecursionlimit(10 ** 7)

def dfs(x):
	if seen[x - 1] == 0:
		uni[cnt].add(x)
		seen[x - 1] = 1
		for i in fri[x - 1]:
			dfs(i)
(n, m, k) = map(int, input().split())
fri = [[] for i in range(n)]
blk = [[] for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	fri[a - 1].append(b)
	fri[b - 1].append(a)
for i in range(k):
	(c, d) = map(int, input().split())
	blk[c - 1].append(d)
	blk[d - 1].append(c)
seen = [0 for i in range(n)]
uni = []
cnt = 0
for i in range(1, n + 1):
	if seen[i - 1] == 0:
		uni.append(set())
		dfs(i)
		cnt += 1
seq = [0 for i in range(n)]
for unii in uni:
	for j in unii:
		cj = len(unii) - len(fri[j - 1]) - len(unii & set(blk[j - 1])) - 1
		seq[j - 1] = cj
print(*seq)


from collections import deque
(n, m, k) = map(int, input().split())
friends = [set() for _ in range(n)]
blocks = [set() for _ in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	friends[a - 1].add(b - 1)
	friends[b - 1].add(a - 1)
for i in range(k):
	(c, d) = map(int, input().split())
	blocks[c - 1].add(d - 1)
	blocks[d - 1].add(c - 1)
q = deque()
ans = [0] * n
visited = [0] * n
for i in range(n):
	if visited[i]:
		continue
	group = {i}
	visited[i] = 1
	q.append(i)
	while q:
		k = q.popleft()
		for j in friends[k]:
			if not visited[j]:
				q.append(j)
				group.add(j)
				visited[j] = 1
	for l in group:
		ans[l] = len(group) - len(blocks[l] & group) - len(friends[l] & group) - 1
print(*ans)


class UnionFind:

	def __init__(self, numV):
		self.pars = list(range(numV))
		self.ranks = [0] * numV
		self.sizes = [1] * numV

	def getRoot(self, x):
		par = self.pars[x]
		if par != x:
			self.pars[x] = par = self.getRoot(par)
		return par

	def merge(self, x, y):
		(x, y) = (self.getRoot(x), self.getRoot(y))
		(sx, sy) = (self.sizes[x], self.sizes[y])
		if x == y:
			return (0, 0)
		if self.ranks[x] < self.ranks[y]:
			self.pars[x] = y
			self.sizes[y] += sx
		else:
			self.pars[y] = x
			self.sizes[x] += sy
			if self.ranks[x] == self.ranks[y]:
				self.ranks[x] += 1
		return (sx, sy)

	def isSame(self, x, y):
		return self.getRoot(x) == self.getRoot(y)

	def updatePars(self):
		for v in range(len(self.pars)):
			self.getRoot(v)

	def getSize(self, x):
		return self.sizes[self.getRoot(x)]
(n, m, k) = map(int, input().split())
uf = UnionFind(n)
ex = [[] for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	uf.merge(a, b)
	ex[a].append(b)
	ex[b].append(a)
for i in range(k):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	if uf.getRoot(c) == uf.getRoot(d):
		ex[c].append(d)
		ex[d].append(c)
ans = []
for i in range(n):
	r = uf.getRoot(i)
	ans.append(uf.sizes[r] - len(list(set(ex[i]))) - 1)
ans = [str(i) for i in ans]
print(' '.join(ans))


def find(x):
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def unite(x, y):
	(x, y) = (find(x), find(y))
	if x != y:
		if x > y:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x

def same(x, y):
	return find(x) == find(y)

def size(x):
	return -par[find(x)]
(n, m, k) = map(int, input().split())
par = [-1] * n
F = []
B = []
f = [set() for _ in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	F.append([a, b])
for i in range(k):
	(c, d) = map(int, input().split())
	B.append([c, d])
for (a, b) in F:
	a -= 1
	b -= 1
	unite(a, b)
	f[a].add(b)
	f[b].add(a)
a = [size(i) - len(f[i]) - 1 for i in range(n)]
for (c, d) in B:
	c -= 1
	d -= 1
	if same(c, d):
		a[c] -= 1
		a[d] -= 1
print(*a)


from collections import deque
import numpy as np
(N, M, K) = [int(x) for x in input().split()]
friends = [[] for _ in range(N + 1)]
for i in range(M):
	(A, B) = [int(x) for x in input().split()]
	friends[A].append(B)
	friends[B].append(A)
block = [[] for _ in range(N + 1)]
for i in range(K):
	(C, D) = [int(x) for x in input().split()]
	block[C].append(D)
	block[D].append(C)
G = []
check = [False] * (N + 1)
for i in range(1, N + 1):
	if check[i] == False:
		check[i] = True
		g = [i]
		q = deque([i])
		while q:
			j = q.popleft()
			for k in friends[j]:
				if check[k] == False:
					check[k] = True
					g.append(k)
					q.append(k)
		G.append(g)
gr = np.array([0] * (N + 1))
fr = np.array([len(friends[i]) for i in range(N + 1)])
bl = np.array([0] * (N + 1))
for g in G:
	s = set(g)
	for v in g:
		gr[v] = len(g)
		b = set(block[v])
		bl[v] = len(s & b)
ans = gr - fr - bl - np.array([1] * (N + 1))
for i in range(1, N + 1):
	print(ans[i], end='')
	if i == N:
		print('')
	else:
		print(' ', end='')


(n, m, k) = map(int, input().split())
par = [-1 for _ in range(n)]

def find(x):
	if par[x] < 0:
		return x
	par[x] = find(par[x])
	return par[x]

def union(x, y):
	(x, y) = (find(x), find(y))
	if x == y:
		return
	if par[x] > par[y]:
		(x, y) = (y, x)
	par[x] += par[y]
	par[y] = x

def same(x, y):
	return find(x) == find(y)

def size(x):
	return -par[find(x)]
ans = [-1] * n
for i in range(m):
	(a, b) = map(int, input().split())
	union(a - 1, b - 1)
	ans[a - 1] -= 1
	ans[b - 1] -= 1
for j in range(k):
	(c, d) = map(int, input().split())
	if same(c - 1, d - 1):
		ans[c - 1] -= 1
		ans[d - 1] -= 1
for i in range(n):
	ans[i] += size(i)
print(*ans)


(N, M, K) = map(int, input().split())
par = [0] * (N + 1)
num = [0] * (N + 1)
group = [1] * (N + 1)
for i in range(1, N + 1):
	par[i] = i

def root(x):
	if par[x] == x:
		return x
	return root(par[x])

def union(x, y):
	rx = root(x)
	ry = root(y)
	if rx == ry:
		return
	par[max(rx, ry)] = min(rx, ry)
	group[min(rx, ry)] += group[max(rx, ry)]

def same(x, y):
	return root(x) == root(y)
for _ in range(M):
	(a, b) = map(int, input().split())
	union(a, b)
	num[a] += 1
	num[b] += 1
for _ in range(K):
	(c, d) = map(int, input().split())
	if same(c, d):
		num[c] += 1
		num[d] += 1
for i in range(1, N + 1):
	print(group[root(i)] - num[i] - 1, end=' ')


import sys
from collections import Counter
input = sys.stdin.readline
(N, M, K) = map(int, input().split())
lstab = [[] for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split())
	lstab[a - 1].append(b - 1)
	lstab[b - 1].append(a - 1)
visited = [0] * N
cnt = 0
for i in range(N):
	if visited[i] != 0:
		continue
	temp = [i]
	cnt += 1
	visited[i] = cnt
	while temp:
		x = temp.pop()
		for y in lstab[x]:
			if visited[y] != 0:
				continue
			temp.append(y)
			visited[y] = cnt
numcd = [0] * N
for _ in range(K):
	(c, d) = map(int, input().split())
	if visited[c - 1] == visited[d - 1]:
		numcd[c - 1] += 1
		numcd[d - 1] += 1
ans = [0] * N
cnt = Counter(visited)
for i in range(N):
	ans[i] = cnt[visited[i]] - 1 - len(lstab[i]) - numcd[i]
print(*ans)


import sys
input = sys.stdin.readline
(n, m, k) = map(int, input().split())
parent = list(range(n))
rank = [0] * n

def root(x):
	if x != parent[x]:
		x = root(parent[x])
	return x

def same(x, y):
	return root(x) == root(y)

def unite(x, y):
	rx = root(x)
	ry = root(y)
	if rank[rx] < rank[ry]:
		parent[rx] = ry
	else:
		parent[ry] = rx
		if rank[rx] == rank[ry]:
			rank[rx] += 1
f_b = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	unite(a - 1, b - 1)
	f_b[a - 1] += 1
	f_b[b - 1] += 1
for j in range(k):
	(c, d) = map(int, input().split())
	if root(c - 1) == root(d - 1):
		f_b[c - 1] += 1
		f_b[d - 1] += 1
p = [0] * n
ans = []
for i in range(n):
	p[root(i) - 1] += 1
for i in range(n):
	r = p[root(i) - 1] - f_b[i] - 1
	ans.append(r)
print(*ans)


class Unionfind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * (n + 1)

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join(('{}:{}'.format(r, self.members(r)) for r in self.roots()))
(N, M, K) = map(int, input().split())
uf = Unionfind(N)
f = [0 for _ in range(N)]
n = [0 for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	uf.union(a, b)
	f[a] += 1
	f[b] += 1
for _ in range(K):
	(c, d) = map(int, input().split())
	c -= 1
	d -= 1
	if uf.same(c, d):
		n[c] += 1
		n[d] += 1
ans = []
for i in range(N):
	ans.append(uf.size(i) - f[i] - n[i] - 1)
print(*ans)


from collections import deque, Counter
import sys
N_MAX = 100000 + 5
sys.setrecursionlimit(N_MAX)
(N, M, K) = map(int, sys.stdin.readline().rstrip().split())
fr = [[] for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, sys.stdin.readline().rstrip().split())
	fr[a - 1].append(b - 1)
	fr[b - 1].append(a - 1)
bl = [[] for _ in range(N)]
for _ in range(K):
	(a, b) = map(int, sys.stdin.readline().rstrip().split())
	bl[a - 1].append(b - 1)
	bl[b - 1].append(a - 1)
gr = [0] * N

def bfs(u, num):
	q = deque()
	q.append(u)
	gr[u] = num
	while q:
		u = q.popleft()
		for v in fr[u]:
			if gr[v] == 0:
				gr[v] = num
				q.append(v)
num = 1
for i in range(N):
	if gr[i] == 0:
		bfs(i, num)
		num += 1
gr_num = Counter(gr)
ans = []
for i in range(N):
	kouho_suu = gr_num[gr[i]]
	for f in fr[i]:
		if gr[i] == gr[f]:
			kouho_suu -= 1
	for b in bl[i]:
		if gr[i] == gr[b]:
			kouho_suu -= 1
	kouho_suu -= 1
	ans.append(kouho_suu)
print(*ans)


from collections import deque
(n, m, k) = map(int, input().split())
friend = [set() for i in range(n)]
block = [set() for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	friend[a].add(b)
	friend[b].add(a)
for i in range(k):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	block[a].add(b)
	block[b].add(a)
stack = deque()
ans = [0] * n
visited = [0] * n
for i in range(n):
	if visited[i]:
		continue
	now = {i}
	visited[i] = 1
	stack.append(i)
	while stack:
		num = stack.pop()
		for j in friend[num]:
			if visited[j] == 0:
				stack.append(j)
				visited[j] = 1
				now.add(j)
	for i in now:
		ans[i] = len(now) - len(now & friend[i]) - len(now & block[i]) - 1
for answer in ans:
	print(answer, end=' ')


import sys
sys.setrecursionlimit(10 ** 5)
(N, M, K) = map(int, input().split())
friend = [[] for _ in range(N)]
block = [[] for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split())
	friend[a - 1].append(b - 1)
	friend[b - 1].append(a - 1)
for _ in range(K):
	(c, d) = map(int, input().split())
	block[c - 1].append(d - 1)
	block[d - 1].append(c - 1)
sgn = [0 for _ in range(N)]
groupnum = 0

def makenetwork(n, groupnum):
	for item in friend[n]:
		if sgn[item] == 0:
			sgn[item] = groupnum
			makenetwork(item, groupnum)
for k in range(N):
	if sgn[k] == 0:
		groupnum += 1
		sgn[k] = groupnum
		makenetwork(k, groupnum)
count = [0 for _ in range(groupnum)]
for k in range(N):
	count[sgn[k] - 1] += 1
ans = ''
for k in range(N):
	num = count[sgn[k] - 1] - 1 - len(friend[k])
	for item in block[k]:
		if sgn[item] == sgn[k]:
			num -= 1
	ans += str(num) + ' '
ans.rstrip()
print(ans)


def N():
	return int(input())

def L():
	return list(map(int, input().split()))

def NL(n):
	return [list(map(int, input().split())) for i in range(n)]
mod = pow(10, 9) + 7
import sys
import math
import collections
sys.setrecursionlimit(1000000)

class UnionFind:
	par = []

	def __init__(self, n):
		for i in range(n):
			self.par.append(i)

	def root(self, x):
		if self.par[x] == x:
			return x
		else:
			self.par[x] = self.root(self.par[x])
			return self.par[x]

	def same(self, x, y):
		if self.root(x) == self.root(y):
			return True
		else:
			return False

	def unite(self, x, y):
		x = self.root(x)
		y = self.root(y)
		if x == y:
			return
		self.par[y] = x

	def comp(self):
		for i in range(len(self.par)):
			self.root(i)
(n, m, k) = L()
uf = UnionFind(n)
f = [0] * n
for i in range(m):
	(a, b) = L()
	uf.unite(a - 1, b - 1)
	f[a - 1] += 1
	f[b - 1] += 1
uf.comp()
for i in range(k):
	(a, b) = L()
	if uf.par[a - 1] == uf.par[b - 1]:
		f[a - 1] += 1
		f[b - 1] += 1
count = collections.Counter(uf.par)
for i in range(n):
	print(count[uf.par[i]] - f[i] - 1, '', end='')
print()


(n, m, k) = map(int, input().split())
par = [-1] * n

def find(x):
	global par
	if par[x] < 0:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def unite(x, y):
	(x, y) = (find(x), find(y))
	global par
	if x == y:
		return False
	else:
		if par[x] > par[y]:
			(x, y) = (y, x)
		par[x] += par[y]
		par[y] = x
		return True

def size(x):
	return -par[find(x)]

def same(x, y):
	return find(x) == find(y)
from sys import stdin
input = stdin.readline
friend = [0] * n
for i in range(m):
	(a, s) = map(int, input().split())
	a -= 1
	s -= 1
	unite(a, s)
	friend[a] += 1
	friend[s] += 1
anti = [set() for i in range(n)]
for i in range(k):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	anti[a].add(b)
	anti[b].add(a)
print(*[size(i) - 1 - sum((same(i, b) for b in anti[i])) - friend[i] for i in range(n)], sep=' ')


def Find(x, par):
	if par[x] < 0:
		return x
	else:
		par[x] = Find(par[x], par)
		return par[x]

def Unite(x, y, par, rank):
	x = Find(x, par)
	y = Find(y, par)
	if x != y:
		if rank[x] < rank[y]:
			par[y] += par[x]
			par[x] = y
		else:
			par[x] += par[y]
			par[y] = x
			if rank[x] == rank[y]:
				rank[x] += 1

def Same(x, y, par):
	return Find(x, par) == Find(y, par)

def Size(x, par):
	return -par[Find(x, par)]
(n, m, k) = map(int, input().split())
F = [0] * n
B = [0] * n
par = [-1] * n
rank = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	F[a] += 1
	F[b] += 1
	Unite(a, b, par, rank)
for i in range(k):
	(c, d) = map(int, input().split())
	(c, d) = (c - 1, d - 1)
	if Same(c, d, par):
		B[c] += 1
		B[d] += 1
ans = [0] * n
for i in range(n):
	ans[i] = Size(i, par) - F[i] - B[i] - 1
print(*ans)


(n, m, k) = map(int, input().split())
par = [i for i in range(n)]
size = [1 for i in range(n)]

def find(x):
	if par[x] == x:
		return x
	else:
		par[x] = find(par[x])
		return par[x]

def union(a, b):
	x = find(a)
	y = find(b)
	if x != y:
		if size[x] < size[y]:
			par[x] = par[y]
			size[y] += size[x]
		else:
			par[y] = par[x]
			size[x] += size[y]
	else:
		return
graph = [[] for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	union(a - 1, b - 1)
	graph[a - 1].append(b - 1)
	graph[b - 1].append(a - 1)
for i in range(k):
	(a, b) = map(int, input().split())
	if find(a - 1) == find(b - 1):
		graph[a - 1].append(b - 1)
		graph[b - 1].append(a - 1)
ans = []
for i in range(n):
	cnt = size[find(i)]
	xxx = list(set(graph[i]))
	cnt -= len(xxx)
	cnt -= 1
	ans += [str(cnt)]
print(' '.join(ans))


from collections import deque
LI = lambda : list(map(int, input().split()))
(n, m, k) = LI()
adj = [[] for i in range(n)]
for i in range(m):
	(a, b) = LI()
	adj[a - 1].append(b - 1)
	adj[b - 1].append(a - 1)
c = []
d = []
for i in range(k):
	tmp = LI()
	c.append(tmp[0] - 1)
	d.append(tmp[1] - 1)
cc = [i for i in range(n)]
num = [0 for i in range(n)]
for i in range(n):
	if cc[i] == i:
		dq = deque([i])
		while dq:
			j = dq.popleft()
			for l in adj[j]:
				if cc[l] != i:
					cc[l] = i
					num[i] += 1
					dq.append(l)
sf = []
for i in range(n):
	sf.append(num[cc[i]])
for i in range(n):
	sf[i] -= len(adj[i])
for i in range(k):
	if cc[c[i]] == cc[d[i]]:
		sf[c[i]] -= 1
		sf[d[i]] -= 1
print(' '.join(map(str, sf)))


class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)
(n, m, k) = map(int, input().split())
g = [[] for _ in range(n)]
uf = UnionFind(n)
for i in range(m):
	(a, b) = map(int, input().split())
	g[a - 1].append(b - 1)
	g[b - 1].append(a - 1)
	uf.union(a - 1, b - 1)
for i in range(k):
	(c, d) = map(int, input().split())
	if uf.same(c - 1, d - 1):
		g[c - 1].append(d - 1)
		g[d - 1].append(c - 1)
ans = [0] * n
for i in range(n):
	ans[i] = uf.size(i) - len(g[i]) - 1
print(*ans)


from collections import defaultdict
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
(N, M, K) = map(int, input().split())

def dfs(v):
	size = 1
	for w in fr[v]:
		if ~roots[w]:
			continue
		roots[w] = roots[v]
		size += dfs(w)
	return size
fr = defaultdict(set)
for _ in range(M):
	(a, b) = [int(x) - 1 for x in input().split()]
	fr[a].add(b)
	fr[b].add(a)
bl = defaultdict(set)
for _ in range(K):
	(a, b) = [int(x) - 1 for x in input().split()]
	bl[a].add(b)
	bl[b].add(a)
roots = [-1] * N
sizes = [-1] * N
for v in range(N):
	if ~roots[v]:
		continue
	roots[v] = v
	sizes[v] = dfs(v)
ans = []
for v in range(N):
	w = roots[v]
	res = sizes[w] - len(fr[v]) - sum((1 for u in bl[v] if roots[u] == w)) - 1
	ans.append(res)
print(*ans)


(n, m, k) = map(int, input().split())
edge = [[] for _ in range(n)]
for _ in range(m):
	(a, b) = map(int, input().split())
	(a, b) = (a - 1, b - 1)
	edge[a].append(b)
	edge[b].append(a)
from collections import deque
label = [-1] * n
i = 0
for start in range(n):
	if label[start] != -1:
		continue
	else:
		i += 1
		label[start] = i
	f = deque([start])
	while f:
		v = f.popleft()
		for e in edge[v]:
			if label[e] == -1:
				label[e] = i
				f.append(e)
Renketsu = [0] * (n + 1)
for i in label:
	Renketsu[i] += 1
Block = [0] * n
for _ in range(k):
	(c, d) = map(int, input().split())
	(c, d) = (c - 1, d - 1)
	if label[c] == label[d]:
		Block[c] += 1
		Block[d] += 1
ans = []
for k in range(n):
	ans.append(Renketsu[label[k]] - 1 - len(edge[k]) - Block[k])
print(*ans)


from _collections import deque
(n, m, k) = map(int, input().split())
fre = [[] for _ in range(n + 1)]
bro = [[] for _ in range(n + 1)]
for i in range(m):
	(a, b) = map(int, input().split())
	fre[a].append(b)
	fre[b].append(a)
for i in range(k):
	(a, b) = map(int, input().split())
	bro[a].append(b)
	bro[b].append(a)
ans = []
x = [-1] * (n + 1)
for i in range(1, n + 1):
	if x[i] == -1:
		x[i] = i
		data = deque([i])
		while len(data) > 0:
			p = data.popleft()
			for j in fre[p]:
				if x[j] == -1:
					x[j] = i
					data.append(j)
g = [0] * (n + 1)
for i in range(1, n + 1):
	g[x[i]] += 1
for i in range(1, n + 1):
	g[i] = g[x[i]]
for i in range(1, n + 1):
	aa = g[i] - 1
	aa -= len(fre[i])
	for j in bro[i]:
		if x[i] == x[j]:
			aa -= 1
	ans.append(str(aa))
print(' '.join(ans))


import sys
(N, M, K) = map(int, input().split())
s = [[] for i in range(N)]
tn = [0] * N
sys.setrecursionlimit(200000)
for i in range(M):
	(a, b) = map(int, input().split())
	s[a - 1].append(b)
	s[b - 1].append(a)
	tn[a - 1] += 1
	tn[b - 1] += 1
l = [None] * N

def hu(n, t):
	l[n] = t
	for i in s[n]:
		if l[i - 1] == None:
			l[i - 1] = t
			hu(i - 1, t)
t = 0
for i in range(N):
	if l[i] == None:
		hu(i, t)
		t += 1
c = [0] * t
for i in l:
	c[i] += 1
for i in range(K):
	(a, b) = map(int, input().split())
	if l[a - 1] == l[b - 1]:
		tn[a - 1] += 1
		tn[b - 1] += 1
for i in range(N):
	print(c[l[i]] - tn[i] - 1, end=' ')


class UnionFind:

	def __init__(self, n):
		self.n = n
		self.root = [-1] * (n + 1)

	def find(self, x):
		if self.root[x] < 0:
			return x
		else:
			self.root[x] = self.find(self.root[x])
			return self.root[x]

	def unite(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return False
		if self.root[x] > self.root[y]:
			(x, y) = (y, x)
		self.root[x] += self.root[y]
		self.root[y] = x

	def is_same(self, x, y):
		return self.find(x) == self.find(y)

	def size(self, x):
		return -self.root[self.find(x)]
(n, m, k) = map(int, input().split())
friends = UnionFind(n)
f_or_b = [1] * (n + 1)
for i in range(m):
	(a, b) = map(int, input().split())
	friends.unite(a, b)
	f_or_b[a] += 1
	f_or_b[b] += 1
for i in range(k):
	(c, d) = map(int, input().split())
	if friends.is_same(c, d):
		f_or_b[c] += 1
		f_or_b[d] += 1
print(*[friends.size(i) - f_or_b[i] for i in range(1, n + 1)])


f = lambda : map(int, input().split())

def r(x):
	while p[x] >= 0:
		x = p[x]
	return x

def u(x, y):
	(x, y) = (r(x), r(y))
	if x == y:
		return
	if x > y:
		(x, y) = (y, x)
	p[x] += p[y]
	p[y] = x
(n, m, k) = f()
(l, p) = ([0] * -~n, [-1] * -~n)
for _ in range(m):
	(a, b) = f()
	u(a, b)
	l[a] -= 1
	l[b] -= 1
for _ in range(k):
	(c, d) = f()
	if r(c) == r(d):
		l[c] -= 1
		l[d] -= 1
for i in range(n + 1):
	l[i] -= p[r(i)] + 1
print(*l[1:])


def main():
	(n, m, k) = list(map(int, input().split()))
	(F, B) = ({}, {})
	for i in range(1, n + 1):
		F[i] = []
		B[i] = []
	for _ in range(m):
		(a, b) = list(map(int, input().split()))
		F[a] += [b]
		F[b] += [a]
	for _ in range(k):
		(a, b) = list(map(int, input().split()))
		B[a] += [b]
		B[b] += [a]
	G = [0 for i in range(n)]
	g = 1
	M = {}
	for i in range(n):
		if G[i] != 0:
			continue
		m = 1
		G[i] = g
		que = [i + 1]
		while len(que) > 0:
			q = que.pop(0)
			for nv in F[q]:
				if G[nv - 1] != 0:
					continue
				G[nv - 1] = g
				que.append(nv)
				m += 1
		M[g] = m
		g += 1
	ans = []
	for i in range(n):
		g = G[i]
		a = M[g]
		for b in B[i + 1]:
			if G[b - 1] == g:
				a -= 1
		a -= len(F[i + 1])
		a -= 1
		ans.append(a)
	print(' '.join([str(a) for a in ans]))

def __starting_point():
	main()
__starting_point()


from collections import deque
(N, M, K) = map(int, input().split())
G = {i: [] for i in range(1, N + 1)}
for _ in range(M):
	(a, b) = map(int, input().split())
	G[a].append(b)
	G[b].append(a)
col = [-1 for _ in range(N + 1)]
cnt = 0
for i in range(1, N + 1):
	if col[i] < 0:
		col[i] = cnt
		que = deque([i])
		while que:
			x = que.popleft()
			for y in G[x]:
				if col[y] < 0:
					col[y] = cnt
					que.append(y)
		cnt += 1
C = {}
for i in range(1, N + 1):
	c = col[i]
	if c not in C:
		C[c] = 0
	C[c] += 1
B = {i: [] for i in range(1, N + 1)}
for _ in range(K):
	(c, d) = map(int, input().split())
	B[c].append(d)
	B[d].append(c)
A = []
for i in range(1, N + 1):
	c = col[i]
	cnt = C[c] - len(G[i]) - 1
	for y in B[i]:
		if col[y] == c:
			cnt -= 1
	A.append(cnt)
print(*A)