Buggy python submission (verdict: Time Limit Exceeded):
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:
      if not bool(use):
        break
      else:
        check=use.popleft()
        if check not in aldic:
          aldic.append(check)
          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])

Fixed submission:
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:
      if not bool(use):
        break
      else:
        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])

Buggy python submission (verdict: Time Limit Exceeded):
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
large=[]
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=[]
    for i in range(0,10**100):
      if not bool(use):
        break
      else:
        check=use.popleft()
        if check not in aldic:
          aldic.append(check)
          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])

Fixed submission:
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:
      if not bool(use):
        break
      else:
        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])

Buggy python submission (verdict: Time Limit Exceeded):
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][b]=1
  fr[b-1][a]=1
for i in range(k):
  a,b=map(int,input().split())
  fr[a-1][b]=0
  fr[b-1][a]=0

def bfs(k):
  use=deque()
  use.append(k)
  ans=0
  aldic={}
  for i in range(0,10**100):
    if not bool(use):
      if k!=n:
        print(ans-1,end=" ")
      else:
        print(ans-1)
      break
    else:
      check=use.popleft()
      if check not in aldic:
        aldic[check]=1
        for x in fr[check-1]:
          if fr[check-1][x]==1:
            use.append(x)
        try:
          if fr[k-1][check]==0:
            pass
          else:
            pass
        except KeyError:
          ans+=1

for i in range(1,n+1):
  bfs(i)

Fixed submission:
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:
      if not bool(use):
        break
      else:
        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])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,m,k=map(int,input().split())
fr=[[]]
bl=[[]]
for i in range(n-1):
  fr.append([])
  bl.append([])
for i in range(m):
  a,b=map(int,input().split())
  fr[a-1].append(b)
  fr[b-1].append(a)
for i in range(k):
  a,b=map(int,input().split())
  bl[a-1].append(b)
  bl[b-1].append(a)

def bfs(k):
  use=deque()
  use.append(k)
  ans=0
  aldic={}
  for i in range(1,n+1):
    aldic[i]=0
  for x in bl[k-1]:
    aldic[x]=-1
  for i in range(0,10**100):
    if not bool(use):
      if k!=n:
        print(ans-len(fr[k-1])-1,end=" ")
      else:
        print(ans-len(fr[k-1])-1)
      break
    else:
      check=use.popleft()
      if aldic[check]==0:
        aldic[check]=1
        for x in fr[check-1]:
          if aldic[x]!=1:
            use.append(x)
        ans+=1
      elif aldic[check]==-1:
        for x in fr[check-1]:
          if aldic[x]!=1:
            use.append(x)
for i in range(1,n+1):
  bfs(i)

Fixed submission:
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:
      if not bool(use):
        break
      else:
        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])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,m,k=map(int,input().split())
fr=[[]]
bl=[[]]
for i in range(n-1):
  fr.append([])
  bl.append([])
for i in range(m):
  a,b=map(int,input().split())
  fr[a-1].append(b)
  fr[b-1].append(a)
for i in range(k):
  a,b=map(int,input().split())
  bl[a-1].append(b)
  bl[b-1].append(a)

def bfs(k):
  use=deque()
  use.append(k)
  ans=0
  aldic={}
  for i in range(0,10**100):
    if not bool(use):
      minus=0
      for x in bl[k-1]:
        if x in aldic:
          minus+=1
      if k!=n:
        print(ans-len(fr[k-1])-1-minus,end=" ")
      else:
        print(ans-len(fr[k-1])-1-minus)
      break
    else:
      check=use.popleft()
      if not check in aldic:
        aldic[check]=1
        for x in fr[check-1]:
          if not x in aldic:
            use.append(x)
        ans+=1
for i in range(1,n+1):
  bfs(i)

Fixed submission:
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:
      if not bool(use):
        break
      else:
        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])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,m,k=map(int,input().split())
fr=[[]]
bl=[{}]
for i in range(n-1):
  fr.append([])
  bl.append({})
for i in range(m):
  a,b=map(int,input().split())
  fr[a-1].append(b)
  fr[b-1].append(a)
for i in range(k):
  a,b=map(int,input().split())
  bl[a-1][b]=1
  bl[b-1][a]=1

def bfs(k):
  use=deque()
  use.append(k)
  ans=0
  aldic={}
  for i in range(0,10**100):
    if not bool(use):
      if k!=n:
        print(ans-len(fr[k-1])-1,end=" ")
      else:
        print(ans-len(fr[k-1])-1)
      break
    else:
      check=use.popleft()
      if not check in aldic:
        aldic[check]=1
        for x in fr[check-1]:
          if not x in aldic:
            use.append(x)
        if not check in bl[k-1]:
          ans+=1
for i in range(1,n+1):
  bfs(i)

Fixed submission:
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:
      if not bool(use):
        break
      else:
        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])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,m,k=map(int,input().split())
fr=[[]]
bl=[[]]
for i in range(n-1):
  fr.append([])
  bl.append([])
for i in range(m):
  a,b=map(int,input().split())
  fr[a-1].append(b)
  fr[b-1].append(a)
for i in range(k):
  a,b=map(int,input().split())
  bl[a-1].append(b)
  bl[b-1].append(a)

def bfs(k):
  use=deque()
  use.append(k)
  ans=0
  aldic={}
  for i in range(0,10**100):
    if not bool(use):
      if k!=n:
        print(ans-len(fr[k-1])-1,end=" ")
      else:
        print(ans-len(fr[k-1])-1)
      break
    else:
      check=use.popleft()
      if not check in aldic:
        aldic[check]=1
        for x in fr[check-1]:
          if not x in aldic:
            use.append(x)
        if not check in bl[k-1]:
          ans+=1
for i in range(1,n+1):
  bfs(i)

Fixed submission:
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:
      if not bool(use):
        break
      else:
        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])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,m,k=map(int,input().split())
fr=[[]]
bl=[[]]
for i in range(n-1):
  fr.append([])
  bl.append([])
for i in range(m):
  a,b=map(int,input().split())
  fr[a-1].append(b)
  fr[b-1].append(a)
for i in range(k):
  a,b=map(int,input().split())
  bl[a-1].append(b)
  bl[b-1].append(a)

def bfs(k):
  use=deque()
  use.append(k)
  ans=0
  aldic={}
  for i in range(0,10**100):
    if not bool(use):
      if k!=n:
        print(ans-len(fr[k-1])-1,end=" ")
      else:
        print(ans-len(fr[k-1])-1)
      break
    else:
      check=use.popleft()
      if not check in aldic:
        aldic[check]=1
        for x in fr[check-1]:
            use.append(x)
        if not check in bl[k-1]:
          ans+=1
for i in range(1,n+1):
  bfs(i)

Fixed submission:
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:
      if not bool(use):
        break
      else:
        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])