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):
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd



import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


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

if __name__ == '__main__':
    main()

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

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

Solution (Python):
import sys

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

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

toshi_flag = [0] * n

for i in range(len(toshi)):
    for j in range(len(toshi[i])):
        toshi_flag[toshi[i][j] - 1] += 1

for item in toshi_flag:
    print("{}".format(item))

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

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

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

Solution (Python):
n,m = map(int,input().split())
A = []; B = []; C = [0 for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    A.append(a); B.append(b)
    
for j in range(m):
    C[A[j]-1] += 1
    C[B[j]-1] += 1

for k in range(n):
    print(C[k])

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

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

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

Solution (Python):
from collections import Counter

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

l = []

for _ in range(M):
    a, b = input().split()
    l.append(str(a))
    l.append(str(b))





nums = [str(i) for i in range(1, N + 1, 1)]

for num in nums:
    print(l.count(num))

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

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

Solution (Python):








def resolve():

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

    for k in range(1,N+1):
        cnt=0
        for i in A:
            for j in i:
                if j==k:
                    cnt+=1
        print(cnt)

        

resolve()

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


dic = {}

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

    try:
        dic[a] += 1
    except:
        dic[a] = 1

    try:
        dic[b] += 1
    except:
        dic[b] = 1



for i in range(1,n+1):
    try:
        print(dic[i])
    except:
        print(0)

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

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

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

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

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

Solution (Python):

from collections import Counter
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, M: int, a: "List[int]", b: "List[int]"):
    c = Counter(a + b)
    for i in range(1, N + 1):
        print(c[i])


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    M = int(next(tokens))  
    a = [int()] * (M)  
    b = [int()] * (M)  
    for i in range(M):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, M, a, b)


if __name__ == '__main__':
    main()

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 = []
for i in range(n):
    city.append([i,0])

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

for j in range(n):
    print(city[j][1])

Solution (Python):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M=MI()
    cnt=[0]*N
    for i in range(M):
        a,b=MI()
        a-=1
        b-=1
        cnt[a]+=1
        cnt[b]+=1
        
    for i in range(N):
        print(cnt[i])

main()

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 _ in range(n):
    print(ans[_])

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())
list=[]
for z in range(M):
    a,b=map(int,input().split())
    list.append(a)
    list.append(b)
for a in range(1,N+1):
    print(list.count(a))

Solution (Python):


N, M = map(int,input().split())
C = [0] * (N+1)

for i in range(M):
    a, b = map(int,input().split())
    C[a] += 1
    C[b] += 1
    
for i in range(N):
    print(C[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):
n , m = map(int,input().split())
road = [0]*n
src = [tuple(map(int,input().split())) for i in range(m)]
for a , b in src:
    road[a-1] += 1
    road[b-1] += 1
for r in road:
    print(r)

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

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

ans=[0]*N
for a in A:
    ans[a[0]-1]+=1
    ans[a[1]-1]+=1

for a in ans:
    print(a)

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 (N):
    print(l.count(i+1))

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

Solution (Python):
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7


N, M = MI()
d = {i: 0 for i in range(N)}
for _ in range(M):
    a, b = MI()
    d[a - 1] += 1
    d[b - 1] += 1
for i in range(N):
    print(d[i])

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

roads = {i : 0 for i in range(N)}
for path in paths:
  roads[path[0]-1] +=1
  roads[path[1]-1] +=1

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

Solution (Python):
import sys
input = sys.stdin.readline
import string

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

Solution (Python):
N, M = map(int,input().split())
a = []
for i in range(M):
  K,S = map(int, input().split())
  a.append(K)
  a.append(S)
for i in range(N):
  print(a.count(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
print(*ans,sep='\n')

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 i in g:
    print(len(i))

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

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

Solution (Python):


n,m =list(map(int,input().split()))
a = [list(map(int,input().split())) for _ in range(m)]
c = [0] * n

for i in range(m):
    c[a[i][0]-1] += 1
    c[a[i][1]-1] += 1
for j in range(n):
    print(c[j])

Solution (Python):
N, M = map(int, input().split())
num_listP = [list(map(int, input().split())) for _ in range(M)]
num_list = [e for row in num_listP for e in row]

ans = []
cnt = 0

for i in range(1, N+1):
    ans.append(cnt)
    cnt = 0
    for j in num_list:
        if i == j:
            cnt += 1

ans.append(cnt)
for i in range(1, N+1):
    print(ans[i])

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

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

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

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

for i in range(1,n+1):
    x = 0
    for j in range(len(l)):
        if i == l[j]:
            x += 1
    print(x)

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

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

Solution (Python):
N, M = map(int, input().split())
root_dic = {}
for i in range(N):
    root_dic[i+1] = 0
for i in range(M):
    root = list(map(int, input().split()))
    for i in range(2):
        root_dic[root[i]] += 1
for i, v in sorted(root_dic.items()):
    print(v)

Solution (Python):
n, m = [int(e) for e in input().split()]
map_dict = {}
for i in range(n):
    map_dict[str(i+1)] = 0
for _ in range(m):
    cities = [e for e in input().split()]
    map_dict[cities[0]]+=1
    map_dict[cities[1]]+=1
for i in range(n):
    print(map_dict[str(i+1)])

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

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

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

Solution (Python):
n, m = map(int, input().split())
r = [0 for _ in range(n)]
for i in range(m):
    a, b = map(int, 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())
l=[input().split() for i in range(m)]
l=[[int(i) for i in j] for j in l]
ans=list(range(1,n+1))
d=dict(zip(ans,[0]*n))

for j in ans:
  for i in l:
    if i[0]==j or i[1]==j:
      d[j]+=1
for i in d:
  print(d[i])

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

a_lis = []
b_lis = []

for _ in range(M):
    a, b = map(int, input().split())
    a_lis.append(a)
    b_lis.append(b)
 

new_lis = a_lis + b_lis
set_new_lis = sorted(set(new_lis))
set_new_lis

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

Solution (Python):


import sys
import os
import math

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

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

    A[a] += 1
    A[b] += 1

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

Solution (Python):
def main():
    cities, roads = map(int, input().split())
    count = [0] * cities
    for _ in range(roads):
        begin, end = map(int, input().split())
        count[begin - 1] += 1
        count[end - 1] += 1
    for i in range(cities):
        print(count[i])


if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(int)
for _ in range(m):
  a, b = input().split()
  d[a] += 1
  d[b] += 1
for i in range(n):
  print(d[str(i + 1)])

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

bridges = []

for i in range(m):
    bridges += list(map(int, input().split(' ')))
    
counter  = [0] * n
for i in range(m * 2):
    counter[bridges[i] - 1] += 1

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

Solution (Python):
from collections import Counter

N,M=map(int,input().split())
R=Counter()
for i in range(M):
    a,b=map(int,input().split())
    R[a]+=1
    R[b]+=1
    
for i in range(N):
    print(R[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 x in ans:
  print(x)

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

Solution (Python):
import numpy as np
N,K=map(int,input().split())
A=np.zeros(N)
for i in range(K):
  S=list(map(int,input().split()))
  A[S[0]-1]+=1
  A[S[1]-1]+=1
for i in range(N):
  print(int(A[i]))

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

lst2 = [0]*n

for i,j in lst1:
    lst2[i-1] += 1
    lst2[j-1] += 1

for i in lst2:
    print(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 x in ans:
  print(x)

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

ans = [0 for i in range(N+1)]

for i in range(M) :
    ans[P[i][0]] += 1
    ans[P[i][1]] += 1

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

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

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

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

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

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

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

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

from collections import defaultdict
d = defaultdict(int)
for _ in range(m):
    a, b = map(int, input().split())
    d[a] += 1
    d[b] += 1
    
for i in range(1, n+1):
    print(d[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):
a,b=map(int,input().split())
t=[0]*b
x=[0]*b
N=1
for i in range(b):
    t[i],x[i] = map(int,input().split())
A=t+x
for z in range(a):
    print(A.count(N))
    N+=1

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

for i in range(0, M):
    A, B = list(map(int, input().split()))
    a.append(A)
    b.append(B)

a.extend(b)

for i in range(1, N+1):
    count = 0
    for j in range(0, 2*M):
        if a[j] == i:
            count += 1
    count_raw.append(count)

for i in range(0, N):
    print(count_raw[i])

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

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

Solution (Python):
N, M = map(int, input().split())
li = [list(map(int, input().split())) for i in range(M)]
dic = {}
for i in range(N) :
    dic[i] = 0
for l in li :
    dic[l[0] - 1] += 1
    dic[l[1] - 1] += 1
for v in dic.values() :
    print(v)

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

Solution (Python):




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

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

for a,b in roads:
    city_road[str(a)] += 1
    city_road[str(b)] += 1

for i in range(1,N+1):
    print(city_road[str(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 ans:
    print(i)

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

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

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

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

Solution (Python):
import sys
from collections import defaultdict
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    roads = [list(input().split()) for _ in range(M)]
    road_num = defaultdict(int)
    for road in roads:
        road_num[road[0]] += 1
        road_num[road[1]] += 1
    for i in range(1, N+1):
        print(road_num[str(i)])

if __name__ == '__main__':
    main()

Solution (Python):


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

    for road in roads:
        print(road)

Solution (Python):
[N, M] = list(map(int, input().split()))
[s, e] = [ [], [] ]
for _ in range(M):
  input_line = list(map(int, input().split()))
  s.append(input_line[0])
  e.append(input_line[1])
bucket = {}
for i in range(1, N+1):
  bucket[i] = []

for i in range(M):
  if s[i] in bucket and e[i] in bucket:
    bucket[s[i]].append(s[i])
    bucket[e[i]].append(e[i])
  elif s[i] in bucket:
    bucket[s[i]].append(s[i])
    bucket[e[i]] = [e[i]]
  elif e[i] in bucket:
    bucket[s[i]] = [s[i]]
    bucket[e[i]].append(e[i])
  else:
    bucket[s[i]] = [s[i]]
    bucket[e[i]] = [e[i]]

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

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

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

for i in range(0,M):
	lst.extend(input().split(" "))
for i in range(1,N+1):
	print(lst.count("{}".format(i)))

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

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

for i in range(1, n+1):
    print(a.count(i) + b.count(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 range(n):
  print(lis[i])

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

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

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

Solution (Python):
n, m = map(int, input().split())
abList = [list(map(int, input().split())) for _ in range(m)]
num = [0 for _ in range(n + 1)]
for i in range(m):
    for j in range(2):
        num[abList[i][j]] += 1
for i in range(n):
    print(num[i + 1])

Solution (Python):


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

d={}
for i in range(m):
    a,b=map(int,input().split())
    if a in d:
        d[a]=d[a]+1
    else:
        d[a]=1

    if b in d:
        d[b]=d[b]+1
    else:
        d[b]=1

for i in range(n):
    if i+1 in d:
        print(d[i+1])
    else:
        print(0)

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')

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



def prime_factorization(n):
    fact=defaultdict(int)
    for i in range(2, int(sqrt(n)) + 1):
        while n % i == 0:
            n //= i
            fact[i]+=1
    if n!=1:
        fact[n]+=1
    return fact


class ModInt:
    def __init__(self, x):
        self.x = x % mod
    
    def __str__(self):
        return str(self.x)
    
    __repr__ = __str__

    def __add__(self, other):
        if isinstance(other, ModInt):
            return ModInt(self.x + other.x)
        else:
            return ModInt(self.x + other)

    __radd__ = __add__
        
    def __sub__(self, other):
        if isinstance(other, ModInt):
            return ModInt(self.x - other.x)
        else:
            return ModInt(self.x - other)

    def __rsub__(self, other):
        if isinstance(other, ModInt):
            return ModInt(other.x - self.x)
        else:
            return ModInt(other - self.x)

    def __mul__(self, other):
        if isinstance(other, ModInt):
            return ModInt(self.x * other.x)
        else:
            return ModInt(self.x * other)

    __rmul__ = __mul__

    def __truediv__(self, other):
        if isinstance(other, ModInt):
            return ModInt(self.x * pow(other.x, mod-2,mod))
        else:
            return ModInt(self.x * pow(other, mod - 2, mod))
            
    def __rtruediv(self, other):
        if isinstance(other, self):
            return ModInt(other * pow(self.x, mod - 2, mod))
        else:
            return ModInt(other.x * pow(self.x, mod - 2, mod))
            

    def __pow__(self, other):
        if isinstance(other, ModInt):
            return ModInt(pow(self.x, other.x, mod))
        else:
            return ModInt(pow(self.x, other, mod))
            

    def __rpow__(self, other):
        if isinstance(other, ModInt):
            return ModInt(pow(other.x, self.x, mod))
        else:
            return ModInt(pow(other, self.x, mod))

class BigCombination(object):

    def __init__(self, mod: int=10**9+7, max_n: int=10**6):
        fac, inv=[1], []
        fac_append, inv_append=fac.append, inv.append

        for i in range(1, max_n+1):
            fac_append(fac[-1] * i % mod)

        inv_append(pow(fac[-1], mod-2, mod))

        for i in range(max_n, 0, -1):
            inv_append(inv[-1] * i % mod)

        self.mod, self.factorial, self.inverse=mod, fac, inv[::-1]

    def get_combination(self, n, r):
        if n < r:
            return 0
        return self.factorial[n] * self.inverse[r] * self.inverse[n-r] % self.mod

    def get_permutation(self, n, r):
        if n < r:
            return 0
        return self.factorial[n] * self.inverse[n-r] % self.mod

def main():
    N,M,*A=map(int,open(0).read().split())
    C=Counter(A)
    for i in range(1,N+1):
        print(C[i])
    


if __name__ == '__main__':
    main()

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

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

Solution (Python):
from collections import defaultdict

n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
cnt=[0]*n

for i in l:
    cnt[i[0]-1]+=1
    cnt[i[1]-1]+=1

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

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

for a in road:
    print(len(a))

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

Solution (Python):
def main():
    N, M = (int(i) for i in input().split())
    c = [0 for i in range(N)]
    for i in range(M):
        a, b = (int(i) for i in input().split())
        c[a-1] += 1
        c[b-1] += 1
    print(*c, sep="\n")


if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
res = [0] * (N + 1)
for _ in range(M):
  u, v = map(int, input().split())
  res[u] += 1
  res[v] += 1
for r in res[1: ]: print(r)

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

Solution (Python):
try:
    N, M = map(int, input().split())
    dp = [[0 for i in range(N)] for j in range(N)]

    for i in range(M):
        a, b = map(int, input().split())
        dp[a-1][b-1] += 1
        dp[b-1][a-1] += 1
    for k in range(len(dp)):
        print(sum(dp[k]))
except EOFError:
    pass

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

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

for country in range(1,N+1):
    count = 0
    for road in R:
        if country in road:
            count += 1
    ans.append(count)

for j in ans:
    print(j)

Solution (Python):
N,M=map(int,input().split())
G=[list() for _ in range(N+1)]
for i in range(M):
    c,d=map(int,input().split())
    G[c].append(d)
    G[d].append(c)

ans = []
for i in range(1,N+1):
    ans.append(len(G[i]))

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

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

for i in range(M):
    l[path[i][0]-1]=l[path[i][0]-1]+1
    l[path[i][1]-1] = l[path[i][1]-1] + 1

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

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

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

for i in result:
    print(i)

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

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

for ans in ansl:
    print(ans)