Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(4100000)

class Uf():
    def __init__(self, n):
        self.par = list(range(N))
 
    def root(self, x):
        if self.par[x] == x:
            return x
        
        root_x = self.root(self.par[x])
        self.par[x] = root_x
        return root_x
    
    def merge(self, a, b):
        root_a, root_b = self.root(a), self.root(b)
        
        if root_a == root_b:
            return
            
        if root_a > root_b:
            root_a, root_b = root_b, root_a
        
        self.par[root_a] = root_b
    
    def isSame(self, a, b):
        return self.root(a) == self.root(b)
    
    def size(self, x):
        return self.par.count(self.par[x])


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

exep = [[] for i in range(N)]

uf = Uf(N)

for i in range(M):
    a, b  = map(int,input().split())
    a, b = a-1, b-1 
    exep[a].append(b)
    exep[b].append(a)
    uf.merge(a, b)

for i in  range(K):
    a, b  = map(int,input().split())
    a, b = a-1, b-1
    if not uf.isSame(a,b):
        continue
    exep[a].append(b)
    exep[b].append(a)

for i in range(N):
    uf.root(i)

for i in range(N):
    print(uf.size(i) - 1 - len(exep[i]), end=" ")

Fixed submission:
import sys
sys.setrecursionlimit(4100000)

class Uf():
    def __init__(self, n):
        self.par = [-1]*N
 
    def root(self, x):
        if self.par[x] < 0:
            return x
        
        root_x = self.root(self.par[x])
        self.par[x] = root_x
        return root_x
    
    def merge(self, a, b):
        a, b = self.root(a), self.root(b)
        
        if a == b:
            return
            
        if self.par[a] > self.par[b]:
            a, b = b, a
        
        self.par[a] += self.par[b]
        self.par[b] = a
                 
    def isSame(self, a, b):
        return self.root(a) == self.root(b)
    
    def size(self, x):
        return -self.par[self.root(x)]


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

exep = [[] for i in range(N)]

uf = Uf(N)

for i in range(M):
    a, b  = map(int,input().split())
    a, b = a-1, b-1 
    exep[a].append(b)
    exep[b].append(a)
    uf.merge(a, b)

for i in  range(K):
    a, b  = map(int,input().split())
    a, b = a-1, b-1
    if not uf.isSame(a,b):
        continue
    exep[a].append(b)
    exep[b].append(a)

for i in range(N):
    print(uf.size(i) - 1 - len(exep[i]), end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
class Uf():
    def __init__(self, n):
        self.par = list(range(N))
 
    def root(self, x):
        if self.par[x] == x:
            return x
        
        root_x = self.root(self.par[x])
        self.par[x] = root_x
        return root_x
    
    def merge(self, a, b):
        root_a, root_b = self.root(a), self.root(b)
        
        if root_a == root_b:
            return
            
        if root_a > root_b:
            root_a, root_b = root_b, root_a
        
        self.par[root_a] = root_b
    
    def isSame(self, a, b):
        return self.root(a) == self.root(b)
    
    def size(self, x):
        return self.par.count(self.par[x])


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

exep = [[] for i in range(N)]

uf = Uf(N)

for i in range(M):
    a, b  = map(int,input().split())
    a, b = a-1, b-1 
    exep[a].append(b)
    exep[b].append(a)
    uf.merge(a, b)

for i in  range(K):
    a, b  = map(int,input().split())
    a, b = a-1, b-1
    if not uf.isSame(a,b):
        continue
    exep[a].append(b)
    exep[b].append(a)

for i in range(N):
    uf.root(i)

for i in range(N):
    print(uf.size(i) - 1 - len(exep[i]), end=" ")

Fixed submission:
import sys
sys.setrecursionlimit(4100000)

class Uf():
    def __init__(self, n):
        self.par = [-1]*N
 
    def root(self, x):
        if self.par[x] < 0:
            return x
        
        root_x = self.root(self.par[x])
        self.par[x] = root_x
        return root_x
    
    def merge(self, a, b):
        a, b = self.root(a), self.root(b)
        
        if a == b:
            return
            
        if self.par[a] > self.par[b]:
            a, b = b, a
        
        self.par[a] += self.par[b]
        self.par[b] = a
                 
    def isSame(self, a, b):
        return self.root(a) == self.root(b)
    
    def size(self, x):
        return -self.par[self.root(x)]


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

exep = [[] for i in range(N)]

uf = Uf(N)

for i in range(M):
    a, b  = map(int,input().split())
    a, b = a-1, b-1 
    exep[a].append(b)
    exep[b].append(a)
    uf.merge(a, b)

for i in  range(K):
    a, b  = map(int,input().split())
    a, b = a-1, b-1
    if not uf.isSame(a,b):
        continue
    exep[a].append(b)
    exep[b].append(a)

for i in range(N):
    print(uf.size(i) - 1 - len(exep[i]), end=" ")