Buggy python submission (verdict: Time Limit Exceeded):
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def find(x):
    if par[x]==x:
        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
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x] == rank[y]:
            rank[x] += 1
def same(x,y):
    return find(x) == find(y)

def main():
    n,m,k = inpm()
    global par,rank
    par = [i for i in range(n)]
    rank = [0 for _ in range(n)]
    ok = defaultdict(int)
    block = defaultdict(int)
    for _ in range(m):
        a,b = inpm()
        unite(a-1,b-1)
        key = ' '.join([str(a-1),str(b-1)])
        ok[key] = 1
        key = ' '.join([str(b-1),str(a-1)])
        ok[key] = 1
    for _ in range(k):
        c,d = inpm()
        key = ' '.join([str(c-1),str(d-1)])
        block[key] = 1
        key = ' '.join([str(d-1),str(c-1)])
        block[key] = 1
    ans = [0 for _ in range(n)]
    for i in range(n-1):
        for j in range(i+1,n):
            if block[' '.join([str(i),str(j)])]:
                continue
            if ok[' '.join([str(i),str(j)])]:
                continue
            if same(i,j):
                ans[i] += 1
                ans[j] += 1
    print(*ans)

    
    
if __name__ == "__main__":
    main()

Fixed submission:
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())

import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n,m,k = inpm()
    uf = UnionFind(n)
    ok = [0 for _ in range(n)]
    block = []
    for _ in range(m):
        a,b = inpm()
        uf.union(a-1,b-1)
        ok[a-1] += 1
        ok[b-1] += 1
    for _ in range(k):
        c,d = inpm()
        block.append((c-1,d-1))
    ans = [-1 for _ in range(n)]
    for i in range(len(block)):
        [x,y] = block[i]
        if uf.same(x,y):
            ans[x] -= 1
            ans[y] -= 1
    for i in range(n):
        ans[i] += uf.size(i)-ok[i]
    print(*ans)
    
if __name__ == "__main__":
    main()