CodeEff/ECCO huggingface dataset:
# Original solution
import sys

class UFT(): #Union-find tree class
    def __init__(self, N): 
        self.tree = [int(i) for i in range(N)] 
        self.rank = [0 for i in range(N)]

    def find(self, a):
        if self.tree[a] == a: return a
        else:
            self.tree[a] = self.find(self.tree[a])
            return self.tree[a]

    def unite(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b: return
        if self.rank[a] < self.rank[b]: self.tree[a] = b
        else:
            self.tree[b] = a
            if self.rank[a] == self.rank[b]: self.rank[a] += 1

def solve():
    input = sys.stdin.readline
    N, M, K = list(map(int, input().split()))
    parent = UFT(N)
    NG = [0] * N
    Connected = [0] * N
    treeSize = dict()
    for _ in range(M):
        x, y = list(map(int, input().split()))
        parent.unite(x-1, y-1)
        Connected[x-1] += 1
        Connected[y-1] += 1
    for _ in range(K):
        x, y = list(map(int, input().split()))
        if parent.find(x-1) != parent.find(y-1): continue
        parent.unite(x-1, y-1)
        NG[x-1] += 1
        NG[y-1] += 1
    for i in range(N):
        key = parent.find(i)
        if key in treeSize: treeSize[key] += 1
        else: treeSize[key] = 1
    Ans = [0] * N
    for i in range(N):
        Ans[i] = treeSize[parent.find(i)] - Connected[i] - NG[i] - 1
    print((" ".join(map(str, Ans))))

    return 0

if __name__ =="__main__":
    solve()

# Optimized solution
import sys

class UFT(): #Union-find tree class
    def __init__(self, N): 
        self.tree = [int(i) for i in range(N)] 
        self.rank = [0 for i in range(N)]

    def find(self, a):
        if self.tree[a] == a: return a
        else:
            self.tree[a] = self.find(self.tree[a])
            return self.tree[a]

    def unite(self, a, b):
        a = self.find(a)
        b = self.find(b)
        if a == b: return
        if self.rank[a] < self.rank[b]: self.tree[a] = b
        else:
            self.tree[b] = a
            if self.rank[a] == self.rank[b]: self.rank[a] += 1



def solve():
    input = sys.stdin.readline
    N, M, K = list(map(int, input().split()))
    parent = UFT(N)
    connect = dict()
    NG = [0] * N
    friend = [0] * N
    for _ in range(M):
        x, y = list(map(int, input().split()))
        parent.unite(x-1, y-1)
        friend[x-1] += 1
        friend[y-1] += 1
    for i in range(N):
        key = parent.find(i)
        if key in connect: connect[key] += 1
        else: connect[key] = 1
    for _ in range(K):
        c, d = list(map(int, input().split()))
        if parent.find(c-1) == parent.find(d-1):
            NG[c-1] += 1
            NG[d-1] += 1
    Ans = [0] * N
    for i in range(N):
        Ans[i] = connect[parent.find(i)] - friend[i] - NG[i] - 1
    print((" ".join(map(str, Ans))))

    return 0

if __name__ =="__main__":
    solve()
# Original solution
from collections import defaultdict
def answer():
    n, m, k = list(map(int, input().split()))
    friend = defaultdict(set)
    block = defaultdict(set)
    group = defaultdict(set)
    cand = defaultdict(set)
    uft = defaultdict(int)
    for i in range(m):
        a, b = list(map(int, input().split()))
        friend[a].add(b)
        friend[b].add(a)
    for j in range(k):
        c, d = list(map(int, input().split()))
        block[c].add(d)
        block[d].add(c)
    for i in range(1, n+1):
        if uft[i] != 0:
            group[i] = group[uft[i]]
        else:
            group[i] = set()
            q = [i]
            while q:
                p = q.pop()
                if p in group[i]:
                    continue
                q += list(friend[p])
                group[i].add(p)
            for j in group[i]:
                uft[j] = i
        cand[i] = group[i] - friend[i] - block[i]
    return ' '.join(str(len(cand[i])-1) for i in range(1, n+1))

print((answer()))

# Optimized solution
from collections import defaultdict
import sys
sys.setrecursionlimit(100000)

def root(uft, x):
    if uft[x] == x: return x
    uft[x] = root(uft, uft[x])
    return uft[x]

def union(uft, x, y):
    x = root(uft, x)
    y = root(uft, y)
    if x == y:
        return
    uft[x] = y

def answer():
    n, m, k = list(map(int, input().split()))
    friend = defaultdict(set)
    block = defaultdict(set)
    group = defaultdict(set)
    uft = [i for i in range(n+1)]
    for i in range(m):
        a, b = list(map(int, input().split()))
        friend[a].add(b)
        friend[b].add(a)
    for j in range(k):
        c, d = list(map(int, input().split()))
        block[c].add(d)
        block[d].add(c)
    for i in range(1, n+1):
        for j in friend[i]:
            union(uft, j, i)
    for i in range(1, n+1):
        group[root(uft, i)].add(i)
    return ' '.join(str(len(group[uft[i]]-block[i])-len(friend[i])-1) for i in range(1, n+1))

print((answer()))
# Original solution
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

INF = 999999

n, m, k = list(map(int, input().split()))
ab = [[INF]*n for _ in range(n)]
for _ in range(m):
	a, b = list(map(int, input().split()))
	ab[a-1][b-1] = 1
	ab[b-1][a-1] = 1
for i in range(n):
	ab[i][i] = 0

cd = [[0]*n for _ in range(n)]
for _ in range(k):
	c, d = list(map(int, input().split()))
	cd[c-1][d-1] = 1
	cd[d-1][c-1] = 1

ab = warshall_floyd(ab)

ans = ["" for _ in range(n)]
for i, abi in enumerate(ab):
	cnt = 0
	for j, abij in enumerate(abi):
		if cd[i][j] == 1:
			ab[i][j] = -1
		if ab[i][j] >= 2 and ab[i][j] != INF:
			cnt += 1
	ans[i] = str(cnt)

print((" ".join(ans)))


# Optimized solution
n, m, k = list(map(int, input().split()))
friend = [{i+1} for i in range(n)]
exclude = [set() for _ in range(n)]
# print(exclude)
for _ in range(m):
	a,b = list(map(int, input().split()))
	exclude[a-1].add(b)
	exclude[b-1].add(a)
	ai, bi = -1 , -1
	for i, f in enumerate(friend):
		if a in f:
			ai = i
		if b in f:
			bi = i
	if ai != bi and ai != -1 and bi != -1:
		friend[ai] = friend[ai] | friend[bi]
		friend.pop(bi)
	elif ai != -1:
		friend[ai].add(b)
	elif bi != -1:
		friend[bi].add(a)
	else:
		friend.append({a,b})
for _ in range(k):
	c,d = list(map(int, input().split()))
	exclude[c-1].add(d)
	exclude[d-1].add(c)
# print(friend)
# print(exclude)

ans = [[] for _ in range(n)]
for f in friend:
	for ff in f:
		ans[ff-1] = str(len(f - exclude[ff-1]) - 1)

print((" ".join(ans)))
# Original solution
from collections import defaultdict

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 is_same_root(self, x, y):
        return self.find(x) == self.find(y)

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

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

friends = defaultdict(set)
for _ in range(M):
    u, v = [int(x)-1 for x in input().split()]
    friends[u].add(v)
    friends[v].add(u)
    uf.union(u, v)
blocks = [0]*N
for _ in range(K):
    u, v = [int(x)-1 for x in input().split()]
    if uf.is_same_root(u, v):
        blocks[u] += 1
        blocks[v] += 1

res = [uf.get_group_size(i)-len(friends[i])-blocks[i]-1 for i in range(N)]
print((' '.join(map(str, res))))


# Optimized solution
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 is_same_root(self, x, y):
        return self.find(x) == self.find(y)

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

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

# friends = defaultdict(set)
friends = [0]*N
for _ in range(M):
    u, v = [int(x)-1 for x in input().split()]
    # friends[u].add(v)
    # friends[v].add(u)
    friends[u] += 1
    friends[v] += 1
    uf.union(u, v)
blocks = [0]*N
for _ in range(K):
    u, v = [int(x)-1 for x in input().split()]
    if uf.is_same_root(u, v):
        blocks[u] += 1
        blocks[v] += 1

res = [uf.get_group_size(i)-friends[i]-blocks[i]-1 for i in range(N)]
print((' '.join(map(str, res))))
# Original solution
from collections import deque
q = deque([])

def bfs(i):
    t = []
    q.append(i)
    c = [0] * n
    u = q.popleft()
    if G[u] != 0:
        for j in G[u]:
            if not c[j] != 0:
                q.append(j)
    c[u] = 1
    while len(q) != 0:
        u = q.popleft()
        c[u] = 1   
        if G[u] != 0:
            for j in G[u]:
                if c[j] == 0 and not i in G[j] and not j in t:
                    q.append(j)
                    t.append(j)
                elif c[j] == 0 and not j in t:    
                    q.append(j)   
    s = 0
    if not H[i] == 0:
        for j in t:
            if j in H[i]:
                s += 1                    
    return len(t) - s   

n, m, k = map(int, input().split())
G = [0] * n
H = [0] * n
for _ in range(m):
    a, b = map(int, input().split())
    if G[a - 1] == 0:
        G[a - 1] = [b - 1]
    else:
        G[a - 1].append(b - 1)
    if G[b - 1] == 0:
        G[b - 1] = [a - 1]
    else:
        G[b - 1].append(a - 1)
for _ in range(k):
    a, b = map(int, input().split())
    if H[a - 1] == 0:
        H[a - 1] = [b - 1]
    else:
        H[a - 1].append(b - 1)
    if H[b - 1] == 0:
        H[b - 1] = [a - 1]
    else:
        H[b - 1].append(a - 1)
for i in range(n - 1):
    print(bfs(i), end = " ")
print(bfs(n - 1))


# Optimized solution
def get_root(s):
    if s != root[s]:
        root[s] = get_root(root[s])
        return root[s]
    return s

def unite(s, t):
    root_s = get_root(s)
    root_t = get_root(t)
    if not root_s == root_t:
        if rank[s] == rank[t]:
            root[root_t] = root_s
            rank[root_s] += 1
            union_count[root_s] += union_count[root_t]
        elif rank[s] > rank[t]:
            root[root_t] = root_s
            union_count[root_s] += union_count[root_t]
        else:
            root[root_s] = root_t
            union_count[root_t] += union_count[root_s]

def same(s, t):
    if get_root(s) == get_root(t):
        return True
    else:
        return False

n, m, k = list(map(int, input().split()))
root = [i for i in range(n)]
rank = [1 for _ in range(n)]
union_count = [1 for _ in range(n)]
friend_count = [0] * n
for _ in range(m):
    a, b = list(map(int, input().split()))
    unite(a - 1, b - 1)
    friend_count[a - 1] += 1
    friend_count[b - 1] += 1
ans = [-1] * n
for _ in range(k):
    c, d = list(map(int, input().split()))
    if same(c - 1, d - 1):
        ans[c - 1] -= 1
        ans[d - 1] -= 1
for i in range(n):
    r = get_root(i)
    ans[i] += union_count[r] - friend_count[i]
print((" ".join(map(str, ans))))
# Original solution
import sys
sys.setrecursionlimit(10**5)
def bfs(ind):
    kouho=friends[ind]
    for i in kouho:
        if sans[i]!=-1:
            continue
        sans[i]=sans[ind]
        l[sans[ind]].append(i)
        bfs(i)
n,m,k=list(map(int,input().split()))
f=[list(map(int,input().split())) for _ in range(m)]
friends=[set() for _ in range(n)]
friends_num=list([len(x) for x in friends])
bl=[list(map(int,input().split())) for _ in range(k)]
l=[[i] for i in range(n)]

for each in f:
    a,b=each
    friends[a-1].add(b-1)
    friends[b-1].add(a-1)

block=[set() for _ in range(n)]
for each in bl:
    a,b=each
    block[a-1].add(b-1)
    block[b-1].add(a-1)

sans=[-1 for _ in range(n)]
sans[0]=0
bfs(0)
for i in range(n):
    if sans[i]!=-1:
        continue
    sans[i]=i
    bfs(i)
ans=[0 for _ in range(n)]
for i in range(n):
    l[i]=set(l[i])


for i in range(n):
    tmp=l[sans[i]]-block[i]
    ans[i]=len(tmp)-len(friends[i])-1


ans=" ".join(map(str,ans))
print(ans)


# Optimized solution
import sys
sys.setrecursionlimit(10**5)
total=0
def bfs(ind,num):
    kouho=friends[ind]
    
    for i in kouho:
        if sans[i]!=-1:
            continue
        num+=1
        sans[i]=sans[ind]
        l[sans[ind]].add(i)
        num+=bfs(i,0)
    return num
n,m,k=list(map(int,input().split()))
f=[list(map(int,input().split())) for _ in range(m)]
friends=[set() for _ in range(n)]
friends_num=list([len(x) for x in friends])
bl=[list(map(int,input().split())) for _ in range(k)]
l=[{i} for i in range(n)]

for each in f:
    a,b=each
    friends[a-1].add(b-1)
    friends[b-1].add(a-1)

block=[set() for _ in range(n)]
for each in bl:
    a,b=each
    block[a-1].add(b-1)
    block[b-1].add(a-1)

sans=[-1 for _ in range(n)]
sans[0]=0
total=bfs(0,total)
for i in range(n):
    if sans[i]!=-1:
        continue
    sans[i]=i
    total=bfs(i,total)
ans=[0 for _ in range(n)]


for i in range(n):
    l[i]=set(l[i])


for i in range(n):
    tmp=l[sans[i]]
    ans[i]+=len(tmp)-len(friends[i])-1
    for j in block[i]:
        if sans[i]==sans[j]:
            ans[j]-=1

ans=" ".join(map(str,ans))
#print("total:",total)
print(ans)
# Original solution
import sys

line = sys.stdin.readline().strip()
n,m,k = list(map(int, line.split()))
roots = list(range(n))
linked = [0]*n
for i in range(m):
    line = sys.stdin.readline().strip()
    a,b = list(map(int, line.split()))
    c, d = a-1,b-1
    linked[c] += 1 
    linked[d] += 1
    while c != roots[c]:
        c = roots[c]
    while d != roots[d]:
        d = roots[d]
    if c!= d:
        roots[c] = d

for i in range(n):
    cursor = i
    while cursor != roots[cursor]:
       cursor = roots[cursor]
    roots[i] = cursor

#print(roots)
res = [0]*n
for i in range(k):
    line = sys.stdin.readline().strip()
    a,b = list(map(int, line.split()))
    c,d = a-1, b-1
    # same group blacklist
    if roots[c] == roots[d]:
        res[c] -= 1
        res[d] -= 1 
set_sizes = dict()

rs = list(set(roots))
for r in rs:
    count = 0
    for one in roots:
        if one == r:
            count += 1
    set_sizes[r] = count

for i in range(n):
    r = roots[i]
    res[i] += (set_sizes[r]-1-linked[i])
print((" ".join(map(str, res))))

# Optimized solution
import sys

line = sys.stdin.readline().strip()
n,m,k = list(map(int, line.split()))
roots = [-1]*n
linked = [0]*n
def find_root(x):
    if roots[x] < 0:
        return x
    else:
        roots[x] = find_root(roots[x])
        return roots[x]
def unite(x, y):
    x = find_root(x)
    y = find_root(y)
    if (x==y):
        return
    if roots[x] > roots[y]:
        c, d = y,x
        x,y = c,d
    roots[x] += roots[y]
    roots[y] = x

for i in range(m):
    line = sys.stdin.readline().strip()
    a,b = list(map(int, line.split()))
    c, d = a-1,b-1
    linked[c] += 1 
    linked[d] += 1
    unite(c,d)
#print(roots)
blacks = [[]for i in range(n)]
for i in range(k):
    line = sys.stdin.readline().strip()
    a,b = list(map(int, line.split()))
    c,d = a-1, b-1
    blacks[c].append(d)
    blacks[d].append(c)
res = []
for i in range(n):
    r = -roots[find_root(i)] - 1 - linked[i]
    for one in blacks[i]:
        if find_root(one) == find_root(i):
            r -= 1
    res.append(r)
    
print((" ".join(map(str, res))))
# Original solution
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

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())
    f[a-1].append(_b-1)
    f[_b-1].append(a-1)
for _ in range(k):
    a, _b = map(int, input().split())
    b[a-1].append(_b-1)
    b[_b-1].append(a-1)

for i in range(n):
    ans = 0
    checked = [False]*n
    checked[i] = True
    def search(node):
        global ans, checked
        if node != i and node not in f[i] and node not in b[i]:
            ans += 1
        for _node in f[node]:
            if not checked[_node]:
                checked[_node] = True
                search(_node)
        return
    search(i)
    print(ans, end=" " if i != n-1 else "\n")


# Optimized solution
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)

#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]

#初期化
#根なら-size,子なら親の頂点

n, m, k = map(int, input().split())
par = [-1]*n
f = [set() for _ in range(n)]
b = [set() for _ in range(n)]
for _ in range(m):
    a, _b = map(int, input().split())
    f[a-1].add(_b-1)
    f[_b-1].add(a-1)
    unite(a-1, _b-1)
for _ in range(k):
    a, _b = map(int, input().split())
    b[a-1].add(_b-1)
    b[_b-1].add(a-1)

for i in range(n):
    ans = size(i)-len(f[i])-1
    for node in b[i]-f[i]:
        if same(i, node):
            ans -= 1
    print(ans, end=" " if i!=n-1 else "\n")
# Original solution
class UnionFind:
    def __init__(self, n):
        self.parent = [ -1 for _ in range(n) ]
        self._size = n

    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x != y:
            if self.parent[y] < self.parent[x]:
                x, y = y, x
            self.parent[x] += self.parent[y]
            self.parent[y] = x
            self._size -= 1

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

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

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


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

uf_tree1 = UnionFind(N)
uf_tree2 = UnionFind(N)

friends = [ [] for _ in range(N) ]
blocks = [ [] for _ in range(N) ]

for _ in range(M):
    a, b = map(int, input().split())
    a -= 1; b -= 1;
    uf_tree1.unite(a, b)
    friends[a].append(b)
    friends[b].append(a)

for _ in range(K):
    c, d = map(int, input().split())
    c -= 1; d -= 1;
    uf_tree2.unite(c, d)
    blocks[c].append(d)
    blocks[d].append(c)

for i in range(N):
    ans = uf_tree1.size(i) - 1
    cand = set()
    for f in friends[i]:
        cand.add(f)
    for b in blocks[i]:
        if uf_tree1.same(i, b):
            cand.add(b)
    ans -= len(cand)
    print(ans, end = "")
    print("\n" if i == N-1 else " ", end = "")


# Optimized solution
class UnionFind:
    def __init__(self, n):
        self.parent = [ -1 for _ in range(n) ]
        self._size = n

    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x != y:
            if self.parent[y] < self.parent[x]:
                x, y = y, x
            self.parent[x] += self.parent[y]
            self.parent[y] = x
            self._size -= 1

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

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

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


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

uf_tree = UnionFind(N)

friends = [ [] for _ in range(N) ]
blocks = [ [] for _ in range(N) ]

for _ in range(M):
    a, b = map(int, input().split())
    a -= 1; b -= 1;
    uf_tree.unite(a, b)
    friends[a].append(b)
    friends[b].append(a)

for _ in range(K):
    c, d = map(int, input().split())
    c -= 1; d -= 1;
    blocks[c].append(d)
    blocks[d].append(c)

for i in range(N):
    ans = uf_tree.size(i) - 1
    cand = set()
    for f in friends[i]:
        cand.add(f)
    for b in blocks[i]:
        if uf_tree.same(i, b):
            cand.add(b)
    ans -= len(cand)
    print(ans, end = "")
    print("\n" if i == N-1 else " ", end = "")
# Original solution
N, M ,K= list(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] = list(map(int, input().split()))
for i in range(K):
    c[i], d[i] = list(map(int, input().split()))

l=list(range(N+1))
r=[0]*(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]
    else:
        l[X]=l[Y]
        if r[X]==r[Y]:
            r[Y]+=1

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])

for i in range(N+1):
    l[i]=find(i)
t=[]
for i in range(N+1):
    p=l.count(l[i])-1-len(di[i])

    t.append(p)


print((" ".join(map(str, t[1:]))))


# Optimized solution
N, M ,K= list(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] = list(map(int, input().split()))
for i in range(K):
    c[i], d[i] = list(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:]))))