Problem:
 Score : 200 points    Problem Statement There are N cities and M roads.
The i -th road (1≤i≤M) connects two cities a_i and b_i  (1≤a_i,b_i≤N) bidirectionally.
There may be more than one road that connects the same pair of two cities.
For each city, how many roads are connected to the city?      Constraints  2≤N,M≤50  1≤a_i,b_i≤N  a_i ≠ b_i  All input values are integers.         Input Input is given from Standard Input in the following format:  N  M  a_1  b_1  :  a_M  b_M       Output Print the answer in N lines.
In the i -th line (1≤i≤N) , print the number of roads connected to city i .        Sample Input 1 4 3
1 2
2 3
1 4      Sample Output 1 2
2
1
1   City 1 is connected to the 1 -st and 3 -rd roads.  City 2 is connected to the 1 -st and 2 -nd roads.  City 3 is connected to the 2 -nd road.  City 4 is connected to the 3 -rd road.        Sample Input 2 2 5
1 2
2 1
1 2
2 1
1 2      Sample Output 2 5
5       Sample Input 3 8 8
1 2
3 4
1 5
2 8
3 7
5 2
4 1
6 8      Sample Output 3 3
3
2
2
2
1
1
2

Solution (Python):
n,m,*ab = map(int, open(0).read().split())

from collections import Counter

c = Counter(ab)

for i in range(1,n+1):
    print(c[i])

Solution (Python):
N, M = map(int,input().split())
city = [0]*N
for _ in range(M):
  a_i, b_i = map(int,input().split())
  city[a_i-1]+=1
  city[b_i-1]+=1
for i in range(N):
  print(city[i])

Solution (Python):
n,m = map(int,input().split())
a = []
for i in range(m):
    a.extend(list(map(int,input().split())))
for i in range(1,n+1):
    print(a.count(i))

Solution (Python):
n,m = map(int,input().split())
r = [0]*n
for i in range(m):
  a,b = map(int,input().split())
  r[a-1]+=1
  r[b-1]+=1
for i in r: print(i)

Solution (Python):
N, M = map(int, input().split())
cnt = [0] * N
for _ in range(M):
    a, b = map(int, input().split())
    cnt[a-1] += 1
    cnt[b-1] += 1
for c in cnt:
    print(c)

Solution (Python):
n, m = map(int, input().split())

ab =[[] for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    ab[a-1].append(b-1)
    ab[b-1].append(a-1)

for i in ab:
    print(len(i))

Solution (Python):
n,m=map(int,input().split())
d={}
for i in range(n):
    d[i]=0
for i in range(m):
    a,b=map(int,input().split())
    d[a-1]+=1
    d[b-1]+=1
for i in range(n):
    print(d[i])

Solution (Python):
N, M = map(int, input().split())
route = [[0 for i in range(N)] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    route[a-1][b-1] += 1
    route[b-1][a-1] += 1
for i in route:
    print(sum(i))

Solution (Python):
n, m = [int(w) for w in input().split()]

ed = [0] * n
for i in range(m):
    a, b = [int(w) - 1 for w in input().split()]
    ed[a] += 1
    ed[b] += 1
print("\n".join([str(w) for w in ed]))

Solution (Python):
N,M = [int(i) for i in input().split()]
list = []

for i in range(M):
  a,b = [int(i) for i in input().split()]
  list.append(a)
  list.append(b)

for i in range(1,N+1):
  print(list.count(i))

Solution (Python):

(n, m), *r = [[*map(int, i.split())] for i in open(0)]
for i in range(1, n + 1):
    print(sum(r, []).count(i))

Solution (Python):
n,m=map(int,input().split())
lst=[0]*n

for i in range(m):
    a,b=map(int,input().split())
    lst[a-1]+=1
    lst[b-1]+=1

for i in lst:
    print(i)

Solution (Python):









import sys
input = sys.stdin.readline

N, M = map(int, input().split())
Load = [0 for i in range(N)]


for i in range(M):
    a, b = map(int, input().split())
    Load[a-1] += 1
    Load[b-1] += 1

for i in range(N):
    print(Load[i])

Solution (Python):
n, m = map(int, input().split())
l = []
for _ in range(m):
    l += list(map(int, input().split()))

for i in range(1, n+1):
    print(l.count(i))

Solution (Python):
n, m = map(int, input().split())
loads = [list(map(int, input().split())) for _ in range(m)]
ans = [0] * (n + 1)
for i in range(m):
    for j in loads[i]:
        ans[j] += 1
for out in range(1, n + 1):
    print(ans[out])

Solution (Python):
N,M = map(int,input().split())
A = [0]*N

for m in range(M):
  a,b = map(int,input().split())
  A[a-1]+=1
  A[b-1]+=1
print(*A,sep="\n")

Solution (Python):
n, m = map(int, input().split())
lst = [0] * n
for i in range(m):
  a, b = map(int, input().split())
  lst[a - 1] += 1
  lst[b - 1] += 1
for i in range(n):
  print(lst[i])

Solution (Python):
n,m = map(int,input().split())
l = [list(map(int,input().split())) for i in range(m)]
a,b = [list(i) for i in zip(*l)]

for i in range(1,n+1):
    t = 0
    t += a.count(i)
    t += b.count(i)
    print(t)

Solution (Python):

N,M = map(int,input().split())
adj = [[0]*N for _ in range(N)]
intx = lambda x: int(x)-1
for i in range(M):
    a,b = map(intx,input().split())
    
    adj[a][b] += 1
    adj[b][a] += 1

for i in range(N): 
    print(sum(adj[i]))

Solution (Python):
n, m = map(int, input().split())
load = []
for _ in range(m):
	load.extend(map(int, input().split()))

for i in range(n):
    print(load.count(i+1))

Solution (Python):

n, m = map(int, input().split())
ab = [map(int, input().split()) for _ in range(m)]
a, b = [list(i) for i in zip(*ab)]

for i in range(1, n + 1):
    ac = a.count(i)
    bc = b.count(i)
    print(ac + bc)

Solution (Python):
n, m = map(int, input().split())
NRD = list(0 for i in range(n))
for i in range(m):
    r1, r2 = map(int, input().split())
    NRD[r1 - 1] += 1
    NRD[r2 - 1] += 1
for i in range(n):
    print(NRD[i])

Solution (Python):
n, m = map(int, input().split())
RD = list(list(map(int, input().split())) for _ in range(m))
for i in range(1, n + 1):
    ans = 0
    for j in RD:
        ans += j.count(i)
    print(ans)

Solution (Python):
N, M = map(int, input().split())
counter = [0]*N
for _ in range(M):
    a, b = map(int, input().split())
    counter[a-1] += 1
    counter[b-1] += 1

for c in counter:
    print(c)

Solution (Python):
N, M = map(int,input().split())
a = 0
b = 0
A = []
B = []
city = [0]*N
for i in range(M):
    a, b = map(int,input().split())
    A.append(a)
    B.append(b)
for i in range(M):
    city[A[i] - 1] += 1
    city[B[i] - 1] += 1
for i in range(N):
    print(city[i])

Solution (Python):
N,M = map(int,input().split())
roads = [0]*N
for i in range(M):
  a,b = map(int,input().split())
  roads[a-1]+=1
  roads[b-1]+=1
for i in roads:
  print(i)

Solution (Python):
N,M = list(map(int,input().split()))
lis = []
for i in range(N):
    lis.append([i+1])
for i in range(M):
    a,b = list(map(int,input().split()))
    lis[a-1].append(b)
    lis[b-1].append(a)
for i in range(N):
    print(len(lis[i])-1)

Solution (Python):
n,m=map(int,input().split())
deg=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    deg[a]+=1
    deg[b]+=1
print(*deg,sep="\n")

Solution (Python):
N, M = map(int, input().split(' '))

ans = []
for n in range(N):
    ans.append(0)

for m in range(M):
    a,b = map(int, input().split(' '))
    ans[a-1] += 1
    ans[b-1] += 1

for a in ans:
    print(a)

Solution (Python):
n,m=[int(i) for i in input().split()]


keys=[i for i in range(1,n+1)]

values=[0]*n

a_dic=dict(zip(keys,values))


for i in range(m):
    a,b=[int(i) for i in input().split()]
    
    a_dic[a]+=1
    a_dic[b]+=1





for i in range(1,n+1):
    print(a_dic[i])

Solution (Python):
n,m = map(int, input().split())

li = []
for i in range(m):
  a,b = map(int, input().split())
  li.append(a)
  li.append(b)

for i in range(1, n+1):
  print(li.count(i))

Solution (Python):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n,m = i2()
ans = [0]*n
for i in range(m):
	a,b = i2()
	ans[a-1] += 1
	ans[b-1] += 1 
	
for i in range(n):
	print(ans[i])

Solution (Python):
n, m = map(int, input().split())
cities = {}
for i in range(n):
    cities[i+1] = 0
for j in range(m):
    a, b = map(int, input().split())
    cities[a] += 1
    cities[b] += 1
for k in cities.values():
    print(k)

Solution (Python):
n, m = map(int, input().split())
g = [[] * n for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    g[a].append(b)
    g[b].append(a)

for path in g:
    print(len(path))

Solution (Python):
N,M=map(int,input().split())
dp=[0]*N
for i in range(M):
  a,b=map(int,input().split())
  dp[a-1]+=1
  dp[b-1]+=1
for j in range(N):
  print(dp[j])

Solution (Python):
N,M=map(int,input().split())
li=[]
for i in range(M):
    a,b=map(int,input().split())
    li.append(a)
    li.append(b)
ans=[0]*N
for j in range(1,N+1):
    cj=li.count(j)
    ans[j-1]=cj
for k in range(N):
    print(ans[k])

Solution (Python):
N, M = map(int, input().split())
G = [[] for _ 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)
for g in G:
    print(len(g))

Solution (Python):
N, M = map(int, input().split())
road = [0 for _ in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    road[a-1] += 1; road[b-1] += 1

for i in range(N):
    print(road[i])

Solution (Python):
N,M=map(int,input().split())
B=[0]*(N+1)
for _ in range(M):
    u,v=map(int,input().split())
    B[u]+=1
    B[v]+=1

for a in range(1,N+1):
    print(B[a])

Solution (Python):
N, M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(M)]
R = sum(A,[])

for i in range(1,N+1):
    print(R.count(i))

Solution (Python):


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

road_count_list = [0] * N

for i in range(M):
    a, b = map(int, input().split())
    road_count_list[a - 1] = road_count_list[a - 1] + 1
    road_count_list[b - 1] = road_count_list[b - 1] + 1

print(*road_count_list, sep='\n')

Solution (Python):
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for n in range(m)]
cnt = [0]*n
cnt.insert(0,"X")
for i in range(m):
	for j in range(2):
		cnt[ab[i][j]] += 1
cnt.pop(0)
for s in range(len(cnt)):
	print(cnt[s])

Solution (Python):
n,m = map(int,input().split())
x = [list(map(int,input().split())) for i in range(m)]
y = []
z = []

for k in range(m):
    y = y + x[k]

for l in range(1,n+1):
    z = z + [y.count(l)]
    
for p in z:
    print(p)

Solution (Python):
n,m=map(int, input().split())
road_num=[0]*n
for i in range(m):
  a,b=map(int, input().split())
  road_num[a-1]+=1
  road_num[b-1]+=1
for i in range(n):
  print(road_num[i])

Solution (Python):
N, M = [int(i) for i in input().split()]
R = [0 for _ in range(N)]
for _ in range(M):
    a, b = [int(i) for i in input().split()]
    R[a - 1] += 1
    R[b - 1] += 1
for i in range(N):
    print(R[i])

Solution (Python):
n, m = map(int, input().split())
a = []
b = []
for i in range(m):
  a_, b_ = map(int, input().split())
  a.append(a_)
  b.append(b_)

for i in range(1, n+1):
  c = a.count(i)
  d = b.count(i)
  print(c+d)

Solution (Python):
N, M = map(int, input().split())

citys = {i: 0 for i in range(1, N+1)}

for _ in range(M):
    a, b = map(int, input().split())
    citys[a] += 1
    citys[b] += 1
    
for num in citys.values():
    print(num)

Solution (Python):
from collections import Counter
N, M = map(int, input().split())
dis_list = []
my_count = Counter()
for i in range(1, N + 1):
    my_count[i] = 0
for i in range(M):
    a, b = map(int, input().split())
    my_count[a] += 1
    my_count[b] += 1
my_count = sorted(my_count.items())
for i in range(N):
    print(my_count[i][1])

Solution (Python):
def main():
    n, m = map(int, input().split())
    count = [0] * n
    for _ in range(m):
        a, b = map(int, input().split())
        count[a-1] += 1
        count[b-1] += 1

    print(*count, sep="\n")


if __name__ == "__main__":
    main()

Solution (Python):
N,M = map(int,input().split())
A = N*[0]

for m in range(M):
  a,b = map(int,input().split())
  A[a-1]+=1
  A[b-1]+=1

print(*A,sep="\n")

Solution (Python):

url = "https://atcoder.jp//contests/abc061/tasks/abc061_b"

def main():
    t = list(map(int, input().split()))
    rode = [0] * t[0]
    for i in range(t[1]):
        r = list(map(int, input().split()))
        rode[r[0]-1] += 1
        rode[r[1]-1] += 1
    for v in rode:
        print(v)



if __name__ == '__main__':
    main()

Solution (Python):
n, m = map(int, input().split())
a, b = [], []
for i in range(m):
  p, q = map(int, input().split())
  a.append(p)
  b.append(q)

for i in range(n):
  print(a.count(i + 1) + b.count(i + 1))

Solution (Python):
N, M = map(int, input().split())

pairs = []
for i in range(M):
    pairs.append(list(map(int, input().split())))

for i in range(1,N+1):
    s = 0
    for pair in pairs:
        if i in pair:
            s += 1
    print(s)

Solution (Python):
n, m = map(int,input().split())
R = list(list(map(int, input().split())) for _ in range(m))
for i in range(1, n+1):
    print(sum(R, []).count(i))

Solution (Python):
def resolve():
    from collections import defaultdict
    N, M = [int(i) for i in input().split()]
    aabb = [list(map(int, input().split())) for _ in range(M)]
    d = defaultdict(int)
    for a, b in aabb:
        d[a] += 1
        d[b] += 1
    for i in range(1, N + 1):
        print(d[i])


resolve()

Solution (Python):
n,m,*a=open(0).read().split()
for i in range(int(n)):print(a.count(str(i+1)))

Solution (Python):
def main():
  n,m = list(map(int,input().split()))
  dic={}
  for i in range(1,n+1):
    dic[i]=0
  for _ in range(m):
    b, c = map(int, input().split())
    dic[b]+=1
    dic[c]+=1
  for i in range(1,n+1):
    print(dic[i])

main()

Solution (Python):
n,m=map(int,input().split())
t=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    t[a-1]+=1
    t[b-1]+=1
for x in t:
  print(x)

Solution (Python):



import sys



def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(cityCount, roadCount, fromCity, toCity):
    result = [0]*(cityCount+1)
    roadRange = range(0, roadCount, +1)
    for j in roadRange:
        city = fromCity[j]
        result[city] = result[city] + 1
        city = toCity[j]
        result[city] = result[city] + 1
    
    
    return result[1:cityCount+1]


if __name__ == "__main__":
    N, M = MI()
    fromCity = []
    toCity = []
    roadRange = range(0, M, +1)
    for _ in roadRange:
        tmp_i, tmp_j = MI()
        fromCity.append(tmp_i)
        toCity.append(tmp_j)
    solveList = solver(N, M, fromCity, toCity)
    
    for j in range(0, N, +1):
        print(solveList[j])

Solution (Python):
n,m = map(int,input().split())
count_list = [0] * n

list = [input() for i in range(m)]

for i in range(m):
    ary = list[i].split()
    count_list[int(ary[0])-1] += 1
    count_list[int(ary[1])-1] += 1

for i in range(n):
  print(count_list[i])

Solution (Python):
n,m = list(map(int,input().split()))
c = [0 for _ in range(n)]
for i in range(m):
    a,b = list(map(int,input().split()))
    c[a-1] += 1
    c[b-1] += 1
for j in c:
    print(j)

Solution (Python):
N, M = map(int, input().split())
town = [0]*M*2
for i in range(M):
    town[i*2], town[i*2+1] = map(int, input().split())

for ans in range(1,N+1):
     print(town.count(ans))

Solution (Python):
N, M = map(int, input().split())
town = [0]*M*2
for i in range(M):
    town[i*2], town[i*2+1] = map(int, input().split())

for ans in range(1,N+1):
     print(town.count(ans))

Solution (Python):
n, m = map(int, input().split())
t=[0]*n
for i in range(m):
    a, b = map(int, input().split())
    t[a-1]+=1
    t[b-1]+=1
for x in t: print(x)

Solution (Python):
N, M = map(int, input().split())
line = [[] for _ in range(N+1)]

for i in range(M):
    a, b = map(int, input().split())
    line[a].append(b)
    line[b].append(a)

for i in range(1, N+1):
    print(len(line[i]))

Solution (Python):
N,M=map(int,input().split())
road=[0]*N
for i in range(M):
  a,b=map(int,input().split())
  road[a-1]+=1
  road[b-1]+=1
for x in road:
  print(x)

Solution (Python):
N, M = map(int, input().split())
road = [0] * N
for _ in range(M):
    a, b = map(int, input().split())
    road[a - 1] += 1
    road[b - 1] += 1
print(*road, sep='\n')

Solution (Python):
N,M=map(int,input().split())
road=[list(map(int,input().split())) for _ in range(M)]
result={i:0 for i in range(1, N+1)}
for i,j in road:
  result[i] += 1
  result[j] += 1
[print(result[i]) for i in range(1, N+1)]

Solution (Python):
def main():
    N, M = map(int, input().split())
    bridge_count = [0] * N
    for _ in range(M):
        a, b = map(int, input().split())
        a -= 1; b -= 1
        bridge_count[a] += 1
        bridge_count[b] += 1
    for i in range(N):
        print(bridge_count[i])

if __name__ == "__main__":
    main()

Solution (Python):
N,M=[int(i) for i in input().split()]
arrR=[0]*N
for m in range(M):
    a,b=[int(i) for i in input().split()]
    arrR[a-1]+=1
    arrR[b-1]+=1
[print(arrR[i]) for i in range(N)]

Solution (Python):
[N, M] = list(map(int, input().split()))
list_cnt = []
for i in range(M):
  ab = list(map(int, input().split()))
  list_cnt.append(ab[0])
  list_cnt.append(ab[1])
for k in range(1, N+1):
  print(list_cnt.count(k))

Solution (Python):
N, M = map(int,input().split())
ls = [0] * N
for _ in range(M):
  a, b = map(int,input().split())
  ls[a-1]+=1
  ls[b-1]+=1

for i in range(N):
  print(ls[i])

Solution (Python):
n, m = map(int, input().split())
count = [0] * n
for i in range(m):
    a = list(map(int, input().split()))
    for j in range(n):
        if j + 1 in a:
            count[j] += 1
for i in range(n):
    print(count[i])

Solution (Python):
N, M =map(int, input().split())
ans = []
for i in range(M):
    a, b = map(int, input().split())
    ans.append(a)
    ans.append(b)

for i in range(1,N+1):
    print(ans.count(i))

Solution (Python):
N, M = map(int, input().split())
A = [[0]*(N+1) for _ in range(N+1)]
for i in range(M):
    a, b = map(int, input().split())
    A[a][b] += 1
    A[b][a] += 1
for i in range(1, N+1):
    sum = 0
    for j in range(1, N+1):
        sum += A[i][j]
    print(sum)

Solution (Python):






N,M = map(int, input().split())
ab = []
mylist = [[] for _ in range(N)]
for _ in range(M):
    ab.append(list(map(int, input().split())))
    mylist[ab[-1][0]-1].append(ab[-1][1])
    mylist[ab[-1][1]-1].append(ab[-1][0])





ans = [len(cities) for cities in mylist]
for x in ans:
    print(x)

Solution (Python):
def resolve():
    N, M = map(int, input().split())
    ans = []
    for _ in range(M):
        a, b = map(int, input().split())
        ans.append(a)
        ans.append(b)
    for i in range(1, N+1):
        print(ans.count(i))
resolve()

Solution (Python):
N,M=map(int,input().split())
A=[]
for _ in range(M):
    a,b=map(int,input().split())
    A.append(a)
    A.append(b)

for i in range(1,N+1):
    print(A.count(i))

Solution (Python):
N, M = map(int, input().split())
R = []
for _ in range(M):
    R += list(map(int, input().split()))

for i in range(1, N+1):
    print(R.count(i))

Solution (Python):
N,M=map(int,input().split())
graph=[[] for _ in range(N)]
for _ in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    graph[a].append(b)
    graph[b].append(a)

for i in range(N):
    print(len(graph[i]))

Solution (Python):
from collections import defaultdict
N, M = map(int, input().split())

G = defaultdict(list)

for _ in range(M):
    a, b = map(int, input().split())
    G[a].append(b)
    G[b].append(a)

for i in range(1, N + 1):
    l = G.get(i, None)
    if l is None:
        print(0)
    else:
        print(len(l))

Solution (Python):
n,m = map(int,input().split())
l = []
for _ in range(m):
    a = list(map(int,input().split()))
    l.append(a)

memo = [0]*n

for i in range(m):
    memo[l[i][0]-1] += 1
    memo[l[i][1]-1] += 1

for j in range(n):
    print(memo[j])

Solution (Python):
N, M = map(int, input().split())
r = [0]*N
for _ in range(M):
    a, b = map(int, input().split())
    r[a-1] += 1
    r[b-1] += 1
for rr in r:
    print(rr)

Solution (Python):
import math
from collections import deque
from collections import defaultdict


def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	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 -1*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 bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	
	ans = data[:]
	return ans

n,m = readInts()
ab = [0]*(n+1)
for i in range(m):
	a,b = readInts()
	ab[a]+=1
	ab[b]+=1

for i in range(1,n+1):
	print(ab[i])

Solution (Python):
n,m = map(int,input().split())
ans = [0] * n
for i in range(m):
    a,b = map(int,input().split())
    ans[a-1] += 1
    ans[b-1] += 1
for i in range(n):
    print(ans[i])

Solution (Python):
n,m=map(int,input().split())
lst=[0]*(n)
for i in range(m):
    a,b=map(int,input().split())
    lst[a-1]+=1
    lst[b-1]+=1
for i in range(n):
    print(lst[i])

Solution (Python):
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
for j in range(n):
    ans = 0
    for k in range(m):
        if ab[k][0] == j + 1:
            ans += 1
        elif ab[k][1] == j + 1:
            ans += 1
    print(ans)

Solution (Python):
n, m = map(int, input().split())
road = []
for _ in range(m):
    a, b = map(int, input().split())
    road.append(a)
    road.append(b)

for i in range(1,n+1):
    print(road.count(i))

Solution (Python):
n,m=map(int,input().split())
l=[]
x=[]
for i in range(m):
    s,t=map(int,input().split())
    l.append(s)
    l.append(t)
for i in range(1,n+1):
    y=l.count(i)
    x.append(y)
    
for i in range(n):
    print(x[i])

Solution (Python):
n,m=map(int,input().split())
lis=[0]*n

for i in range(m):
  a,b=map(int,input().split())
  lis[a-1]+=1
  lis[b-1]+=1
  
for i in lis:
  print(i)

Solution (Python):
def pathnumber(N, M) : 
  path = [0] * (N + 1)
  for i in range(M) : 
    x, y = tuple(map(int, input().split()))
    path[x] += 1 
    path[y] += 1
  return path

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

path = pathnumber(N, M)

for i in range(1, N + 1) : 
  print(path[i])

Solution (Python):
N,M = map(int,input().split())
C = [0]*N
R = [list(map(int,input().split())) for _ in range(M)]
for a,b in R:
    C[a-1] += 1
    C[b-1] += 1
for c in C:
    print(c)

Solution (Python):
a,b=list(map(int,input().split()))
c = [0] * a
for i in range(b):
	x,y=list(map(int,input().split()))
	c[x-1]=c[x-1]+1
	c[y-1]=c[y-1]+1

for j in range(a):
	print(c[j])

Solution (Python):
n,m = map(int,input().split())
ans = [0]*100
for i in range(m):
    a,b = map(int,input().split())
    ans[a-1] += 1
    ans[b-1] += 1
for i in range(n):
    print(ans[i])

Solution (Python):
N,M=map(int,input().split())
city_l=[]
for i in range(M):
    a,b=map(int,input().split())
    city_l.append(a)
    city_l.append(b)
for i in range(1,N+1):
    print(city_l.count(i))

Solution (Python):
N, M = map(int, input().split())
ans = [0] * (N + 1)
for _ in range(M):
    fr, to = map(int, input().split())
    ans[fr] += 1
    ans[to] += 1

print(*ans[1:], sep='\n')

Solution (Python):
n,m=map(int,input().split())
x=[]
for _ in range(m):
    a,b=map(int,input().split())
    x.append(a)
    x.append(b)
for i in range(1,n+1):
    print(x.count(i))

Solution (Python):
def resolve():
    n, m = map(int, input().split())
    ans = list()

    for i in range(n):
        ans.append(0)    

    for i in range(m):
        a, b = map(int, input().split())
        ans[a-1] +=1
        ans[b-1] +=1
    
    for i in range(n):
        print(ans[i])
resolve()

Solution (Python):
N, M = map(int, input().split())
road = [0] * N

for _ in range(M):
    a, b = map(int, input().split())
    road[a - 1] += 1
    road[b - 1] += 1

for i in road:
    print(i)

Solution (Python):
n,m=map(int,input().split())
l=[]
for i in range(m):
  l+=list(map(int,input().split()))
for i in range(1,n+1):
  print(l.count(i))

Solution (Python):
n,m = map(int,input().split())
li=[list(map(int,input().split())) for i in range(m)]
ans_li = [0] * n

for i, j in li:
    ans_li[i-1] += 1
    ans_li[j-1] += 1

print(*ans_li,sep="\n")

Solution (Python):



import sys



def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(CITY_NUM, CITY_LIST):
    
    resultList = [0] * CITY_NUM
    for j in range(0, len(CITY_LIST), +1):
        now_city = CITY_LIST[j]
        resultList[now_city-1] = resultList[now_city-1]+1
    
        
    resultListStr = [str(j) for j in resultList]
    return '\n'.join(resultListStr)
    
    


if __name__ == "__main__":
    N, M = MI()
    ROAD_ENUMERATION_LIST = []
    for j in range(0, M, +1):
        from_tmp, to_tmp = MI()
        ROAD_ENUMERATION_LIST.append(from_tmp)
        ROAD_ENUMERATION_LIST.append(to_tmp)
    print("{}".format(solver(N, ROAD_ENUMERATION_LIST)))

Solution (Python):
def counting_sort(array,city,road):
    bucket = [0] * city

    for i in range(road):
        for j in range(2):
            bucket[ (array[i][j] - 1) ] += 1

    return bucket

def main():
    n,m = map(int, input().split())
    way = [list(map(int,input().split())) for _ in range(m)]
    ans_list = counting_sort(way, n, m)
    for k in range(n):
        print( ans_list[k] )

main()

Solution (Python):
n,m = map(int, input().split())

R = [list(map(int,input().split())) for i in range(m)]

X = []
for i in range(m):
  X.append(R[i][0])
  X.append(R[i][1])
  
for i in range(1,n+1):
  print(X.count(i))

Solution (Python):
N, M = map(int, input().split())
load = {}
for i in range(N):
  load[i] = 0
for i in range(M):
  a, b = map(int, input().split())
  load[a-1] += 1
  load[b-1] += 1
for i in range(N):
  print(load[i])

Solution (Python):
n, m = map(int, input().split())
result = [0 for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    result[a-1] += 1
    result[b-1] += 1

for j in result:
    print(j)

Solution (Python):
n,m=map(int,input().split())
road=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    road[a-1]+=1
    road[b-1]+=1
for i in road:
    print(i)

Solution (Python):
n,m=map(int,input().split())
a=[]
for i in range(m):
  a+=list(map(int,input().split()))

for i in range(n):
  dumy=a.count(i+1)
  print(dumy)

Solution (Python):
n,m = list(map(int,input().strip().split()))

grid = []
for i in range(m):
  array = list(map(int, input().strip().split()))
  grid.append(array)
  
for i in range(1,n+1):
  road = 0
  for j in grid:
    if i in j:
      road +=1
  print(road)

Solution (Python):
n, m = map(int, input().split())
arr = [0] * n
for i in range(m):
  a, b = map(int, input().split())
  arr[a-1] += 1
  arr[b-1] += 1
for e in arr:
  print(e)

Solution (Python):
import numpy as np

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

array = np.zeros(n)

for i in range(m):
    a, b = map(int, input().split(' '))
    array[a-1] += 1
    array[b-1] += 1
    
for number in array:
    print(int(number))

Solution (Python):
n,m=map(int,input().split())
city=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    city[a-1]+=1
    city[b-1]+=1
for i in range(n):
    print(city[i])

Solution (Python):
from collections import defaultdict
N, M = list(map(int, input().split()))
count = defaultdict(int)
for _ in range(M):
    a, b = list(map(int, input().split()))
    count[a] += 1
    count[b] += 1

for i in range(1, N + 1):
    print(count[i])

Solution (Python):
N, M = map(int, input().split())

roads = [0]*N
for i in range(M):
  a, b = map(int, input().split())
  roads[a-1] += 1
  roads[b-1] += 1

for i in roads:
  print(i)

Solution (Python):
n, m = map(int, input().split())
l = []

for i in range(m):
    a, b = map(int, input().split())
    l.append(a)
    l.append(b)

for i in range(1, n + 1):
    print(l.count(i))

Solution (Python):
n,m=map(int,input().split())
result=[]
count=[]
for i in range(n):
    result.append(i+1)
    count.append(0)
for i in range(m):
    a,b=map(int,input().split())
    count[result.index(a)]+=1
    count[result.index(b)]+=1
for i in range(n):
    print(count[i])

Solution (Python):
n,m=map(int,input().split())
result=[]
for _ in range(m):
    a,b=map(int,input().split())
    result.append(a)
    result.append(b)
count=0
for x in range(1,n+1):
    for i in result:
        if x==i:
            count+=1
    print(count)
    count=0

Solution (Python):
def solve():
    n, m = map(int, input().split())
    u = [0] * n
    for _ in range(m):
        a, b = map(int, input().split())
        u[a - 1] += 1
        u[b - 1] += 1
    for i in range(n):
        print(u[i])


if __name__ == '__main__':
    solve()

Solution (Python):
N,M = map(int,input().split())
a =[0]*M
b =[0]*M

ans = [0]*N

for i in range(M):
  a[i],b[i] = map(int,input().split())

for _ in range(M):
  ans[a[_]-1]+=1
  ans[b[_]-1]+=1

for j in range(N):
  print(ans[j])

Solution (Python):
n, m = map(int, input().split())
a = []
for _ in range(m):
    a.append(list(map(int, input().split())))
a = sum(a, [])
for i in range(n):
    print(a.count(i+1))

Solution (Python):
n,m=map(int,input().split())
list1=[]
ans=[]
for i in range(m):
    a,b=input().split()
    list1.append(a)
    list1.append(b)
for i in range(n):
    ans.append(list1.count(str(i+1)))
for i in range(n):
    print(ans[i])

Solution (Python):
N, M=map(int, input().split())
ans=[0]*N
for i in range(M):
  a, b=map(int, input().split())
  ans[a-1]+=1
  ans[b-1]+=1
[print(i) for i in ans]