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=map(int,input().split())
List=[]
for i in range(m):
    a,b=map(int,input().split())
    List.append([a,b])
    List.append([b,a])
ans=0
for i in range(1,n+1):
    for j in range(len(List)):
        if i==List[j][0]:
            ans+=1
    print(ans)
    ans=0

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

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

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

for a in A:
	print(a)

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

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(cityNumber, roadNumber):
    result = [0] * cityNumber
    fromList = []
    toList = []
    for _ in range(0, roadNumber, +1):
        tmp_f, tmp_t = MI()
        fromList.append(tmp_f -1)
        toList.append(tmp_t - 1)
    
    
    city_Count_List = [0] * cityNumber
    for j in range(0,roadNumber,+1):
        city_Count_List[fromList[j]] = city_Count_List[fromList[j]] + 1
        city_Count_List[toList[j]] = city_Count_List[toList[j]] + 1
    result = city_Count_List
    return result
if __name__ == "__main__":
    N, M = MI()
    answerList = solver(N, M)
    for j in range(0, N, +1):
        print("{}".format(answerList[j]))

Solution (Python):
n,m=map(int,input().split())
temp=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  temp[a-1].append(b-1)
  temp[b-1].append(a-1)
for i in range(n):
  print(len(temp[i]))

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

road=[]
for i in range(n):
  road.append([])

for i in range(m):
  a, b = map(int,input().split())
  road[a-1].append(b)
  road[b-1].append(a)
  
for i in range(n):
  print(len(road[i]))

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

Solution (Python):
N, M = map(int, input().split())
ab = [[int(i) for i in input().split()] for i in range(M)]
ans = [0] * N

for a, b in ab:
    ans[a-1] += 1
    ans[b-1] += 1
for i in ans:
    print(i)

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

path = [0]*N

for i in range(M):
    path[a[i]-1] += 1
    path[b[i]-1] += 1

for v in path:
    print(v)

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

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

d = dict.fromkeys(range(1, N+1), 0)

for i in range(M):
    x, y  = map(int, input().split())
    d[x] += 1
    d[y] += 1

for k, v in sorted(d.items()):
    print(v)

Solution (Python):
from collections import defaultdict

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

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

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

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):
def main():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(m)]
    res = [0] * n
    for i in ab:
        res[i[0] - 1] += 1
        res[i[1] - 1] += 1
    for i in res:
        print(i)
if __name__ == '__main__':
    main()

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

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

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

[print(x) for x in num_c]

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

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

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

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

for road in roads:
    print(road)

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n, m = mi()
    adj = [[] for _ in range(n)]

    for _ in range(m):
        a, b = mi_0()
        adj[a].append(b)
        adj[b].append(a)

    for i in range(n):
        print(len(adj[i]))


if __name__ == "__main__":
    main()

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

Solution (Python):

n,m = map(int,input().split())
l = [0]*n

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

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

Solution (Python):
(N, _), *edges = [map(int, s.split()) for s in open(0)]
graph = {i: [] for i in range(N)}
for a, b in edges:
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
print("\n".join(str(len(graph[i])) for i in range(N)))

Solution (Python):
(N, _), *edges = [list(map(int, s.split())) for s in open(0)]
graph = {i: [] for i in range(N)}
for a, b in edges:
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
print("\n".join(str(len(graph[i])) for i in range(N)))

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())
road = [list(map(int, input().split())) for _ in range(M)]
city = [0]*N
for r in road:
    city[r[0] - 1] += 1
    city[r[1] - 1] += 1
print(*city,sep="\n")

Solution (Python):
n,m = map(int,input().split())
a_all = []
b_all = []
for i in range(m):
    a,b = map(int,input().split())
    a_all.append(a-1)
    b_all.append(b-1)
for j in range(n):
    c = list()
    for k in range(m):
        if a_all[k] == j:
            c.append(b_all[k])
        if b_all[k] == j:
            c.append(a_all[k])
    print(len(c))

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

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

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

for i in range(M):
    a,b = map(int,input().split())
    a=a-1
    b=b-1
    glaf[a].append(b)
    glaf[b].append(a)
    
for i in glaf:
    cnt =0
    for j in i:
        cnt+=1
    
    print(cnt)

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

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

Solution (Python):
import itertools
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(M)]

ab = list(itertools.chain.from_iterable(ab))

for x in range(1, N + 1):
    print(ab.count(x))

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

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

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

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

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

Solution (Python):
N, M = map(int,input().split())
road = [input().split() for i in range(M)]
for i in range(N):
    num = 0
    for l in range(M):
        num = num + road[l].count(str(i+1))
    print(num)

Solution (Python):
n, m = map(int, input().split())
ab = [ list(map(int, input().split())) for _ in range(m) ]
import numpy as np
ans = np.array([ [0] * n ] * n)

for i in ab:
    ans[i[0]-1][i[1]-1] += 1
    ans[i[1]-1][i[0]-1] += 1
for  i in ans:
    print(sum(i))

Solution (Python):
argList = list(map(int, input().split())) 

n = argList[0]
m = argList[1]

citys = [0]*n

for i in range(m):
    arg = list(map(int, input().split())) 
    citys[arg[0]-1] +=1 
    citys[arg[1]-1] +=1 

for c in citys:
    print(c)

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

l = [0]*n

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

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

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

ab = [0]*m

for i in range(0,m):
  ab[i] = input().split()

to = [0]*n
d = [0]*2
for i in range(0,m):
  d[0] = int(ab[i][0])
  d[1] = int(ab[i][1])
  to[d[0]-1] += 1
  to[d[1]-1] += 1

for i in range(len(to)):
  print(to[i])

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

ans = [[] for _ in range(n + 1)]
for a, b in ab:
    ans[a].append(b)
    ans[b].append(a)

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

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


city = [0]*N
for i in range(M):
    city[ab[i][0]-1] += 1
    city[ab[i][1]-1] += 1

for number in city:
    print(number)

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

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

ans = []
        
for i in range(1,n+1):
    ans.append(l.count(i))

for i in ans:
    print(i)

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

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

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

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

Solution (Python):
import numpy as np
n, m = map(int, input().split())

mat = [[0] * n] * n
mat = np.array(mat)

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

    mat[a - 1, b - 1] += 1
    mat[b - 1, a - 1] += 1



for i in range(n):
    ans = np.sum(mat[i, :])
    print(ans)

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

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

Solution (Python):
n,m = list(map(int, input().split()))
from collections import defaultdict
d=defaultdict(list)
for _ in range(m):
    a,b = list(map(int, input().split()))
    d[a].append(b)
    d[b].append(a)
ans=[0]*n
for k in d:
    ans[k-1]=len(d[k])
print(*ans, sep='\n')

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

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

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

Solution (Python):

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

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

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

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

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

roads = [ list(map(int, input().split())) for _ in range(M)]

maps = [0 for _ in range(N+1)]

for road in roads:
    maps[road[0]] += 1
    maps[road[1]] += 1

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

Solution (Python):

N, M = map(int, input().split())
metro = {i:0 for i in range(N)}

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

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

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

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

ans = [0] * n
for i in x:
    ans[i[0]-1] += 1
    ans[i[1]-1] += 1

for i in ans:
    print(i)

Solution (Python):
from collections import Counter

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

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

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

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

Solution (Python):
N, M = map(int, input().split())
route = {i: 0 for i in range(N)}
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    route[a] += 1
    route[b] += 1
route = (x[1] for x in sorted(route.items(), key=lambda x: x[0]))
print(*route, sep='\n')

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def Yes(): print("Yes"); return
def No(): print("No"); return


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





N,M = inputIL()

roads = defaultdict(int)
for i in range(M):
  a,b = inputIL()
  roads[a] += 1
  roads[b] += 1

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,M=map(int,input().split())
    edge=[[] for _ in range(N)]
    for i in range(M):
        a,b=map(int1,input().split())
        edge[a].append(b)
        edge[b].append(a)
    for i in range(N):
        print(len(edge[i]))

if __name__ == '__main__':
    main()

Solution (Python):

n,m = map(int,input().split())
s = [0] * n

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

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

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

import itertools

abb = list(itertools.chain.from_iterable(ab))

from collections import Counter
count = Counter(abb)
for i in range(1,n+1):
    print(count[i])

Solution (Python):

import collections
import itertools as it
import math

 


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

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



doro = [0] * (n + 1)

for ab_ in ab:
    a, b = ab_
    doro[a] += 1
    doro[b] += 1

for d in doro[1:]:
    print(d)

Solution (Python):


N, M = map(int, input().split())
D = {}
for i in range(1, N+1):
    D[i] = []

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

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

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

Solution (Python):
from collections import defaultdict

n, m = list(map(int, input().split()))
ab_list = [list(map(int, input().split())) for _ in range(m)]

towns_road = defaultdict(list)
for a, b in ab_list:
    towns_road[a].append(b)
    towns_road[b].append(a)

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

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

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

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

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

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

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

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

[print(road_counts[k]) for k in road_counts]

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 range(N):
    print(road[i])

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):
import sys

input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys

input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

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

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

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

ans = [0]*n

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

for i in ans:
    print(i)

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

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

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

for r in city:
    print (len(r))

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

for i in range(N):
    dict[str(i+1)] = 0
for i in range(M):
    ai, bi = input().split()
    dict[ai] += 1
    dict[bi] += 1

for i in range(N):
    print(dict[str(i+1)])

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

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

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

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

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

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

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

    cities = [0 for _ in range(n)]

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

        cities[a - 1] += 1
        cities[b - 1] += 1
    
    for bridges in cities:
        print(bridges)

if __name__ == '__main__':
    main()

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

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

for ans in table:
    print(ans)

Solution (Python):
import sys
import math
import bisect

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

if __name__ == "__main__":
    main()

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

l = [0]*n

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

for i in range(n):
    print(l[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 j in ans:
    print(j)

Solution (Python):
N, M = map(int, input().split())
a_and_b = [list(map(int, input().split())) for i in range(M)]
for i in range(N):
    ans = 0
    for j in range(M):
        ans += a_and_b[j].count(i+1)
    print(ans)

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

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

Solution (Python):
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
city = {}
for i in ab:
  for j in i:
    if j not in city:
      city[j] = 1
    else:
      city[j] += 1
for number in range(1, n+1):
  if number in city:
    print(city[number])
  else:
    print(0)

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

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

roads = [[] for _ in range(N)]

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

for i in roads:
    print(sum(i))

Solution (Python):
from collections import defaultdict

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

memo = [0]*N

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

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

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

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

c = collections.Counter(sum(A,[]))

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

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

from collections import defaultdict
d = defaultdict(int)
for i in range(m):
    d[ab[i][0]] += 1
    d[ab[i][1]] += 1

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

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

road = [[0]*N for i in range(N)]

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

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

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

Solution (Python):
N, M = map(int, input().split())
ans = [0 for _ in range(N)]
for _ 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())

num = [0] * n

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

for x in range(0, n):
    print(num[x])

Solution (Python):
N,M = map(int, input().split())
A = [map(int,input().split()) for _ in range(M)]
S = []
for i in A:
    for j in i:
        S.append(j)
for i in range(1,N+1):
    print(S.count(i))

Solution (Python):
n , m = map(int , input().split())
ans = [0] * n
for i in range(m):
  inp = list(map(int , input().split()))
  ans[inp[0] - 1] += 1
  ans[inp[1] - 1] += 1
print('\n'.join([str(n) for n in ans]))

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

road = [0] * n

for i in range(m):
    road[a[i] - 1] += 1
    road[b[i] - 1] += 1

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

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

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

Solution (Python):
def main():
    n, m = map(int, input().split())
    ABs = [list(map(int, input().split())) for _ in range(m)]
    anss = [0]*n
    for AB in ABs:
        anss[AB[0]-1] += 1
        anss[AB[1]-1] += 1
    for ans in anss:
        print(ans)


if __name__ == "__main__":
    main()

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

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

for ab in AB:
  ANS[ab[0] - 1] += 1
  ANS[ab[1] - 1] += 1

[print(ans) for ans in ANS]

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 ans:
    print(i)

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

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

from collections import Counter
def resolve():
    N,M=pin()
    ans=[0]*N
    for i in range(M):
        a,b=pin()
        ans[a-1]+=1
        ans[b-1]+=1
    for an in ans:
        print(an)

resolve()

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