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):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

N,M = m()

data = [[0 for i in range(N)] for j in range(N)]

for i in range(M):
    a,b = m()
    a -= 1
    b -= 1
    data[a][b] += 1
    data[b][a] += 1
for i in range(N):
    print(sum(data[i]))

Solution (Python):
lst1 = input().split()

N = int(lst1[0])
M = int(lst1[1])

lst2 = []

for i in range(M):
   lst2.append(input().split())

lst3 = []
for i in range(N):
   lst3.append(0)

for i in range(M):
   for j in range(2):
      lst3[ int(lst2[i][j]) - 1 ] += 1

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

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

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

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

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

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

for j in range(M):
    cnt[a[j]-1]+=1
    cnt[b[j]-1]+=1

for s in range(N):
    print(cnt[s])

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

for i in range(M):
   a, b = list(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())
ab = [list(map(int,input().split())) for _ in range(M)]

g = {i:0 for i in range(N)}

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

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

g = {i:[] for i in range(N)}

for a,b in ab:
    g[a-1].append(b)
    g[b-1].append(a)
    
for i in g.values():
    print(len(i))

Solution (Python):
N,M= map(int,input().split())
AB = [list(map(lambda x:x-1,[int(i) for i in input().split()])) for _ in range(M)]
c = [0]*N

for i in range(M) :
    c[AB[i][0]] += 1
    c[AB[i][1]] += 1

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

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

c_list=[0]*n

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

for i in c_list:
    print(i)

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

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

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())
a = []
for i in range(M):
    b, c = map(int, input().split())
    a.append(b)
    a.append(c)

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

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

for i in w:
    print(i)

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

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

Solution (Python):

N,M = map(int,input().split())
a = []
b = []
for _ in range(M):
    ai,bi = map(int,input().split())
    a.append(ai)
    b.append(bi)
start = a + b
count = [0]*N
for i in range(len(start)):
    count[start[i]-1] += 1
    
for o in range(N):
    print(count[o])

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

Solution (Python):




def resolve():
    import sys
    input = sys.stdin.readline
    n, m = [int(x) for x in input().rstrip().split(" ")]

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

    for i in range(m):
        a, b = [int(x) for x in input().rstrip().split(" ")]
        ans[a-1] += 1
        ans[b-1] += 1

    print("\n".join([str(a) for a in ans]))


if __name__ == "__main__":
    resolve()

Solution (Python):
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(M)]
for i in range(1,N+1):
    print(sum(ab,[]).count(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
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4 3
1 2
2 3
1 4"""
        output = """2
2
1
1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """2 5
1 2
2 1
1 2
2 1
1 2"""
        output = """5
5"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """8 8
1 2
3 4
1 5
2 8
3 7
5 2
4 1
6 8"""
        output = """3
3
2
2
2
1
1
2"""
        self.assertIO(input, output)


def resolve():
    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])


if __name__ == "__main__":
    
    resolve()

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

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

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

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

Solution (Python):

from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement


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

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

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

  
if __name__ == "__main__":
  	main()

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









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

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

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

for h in range(1,n+1):
    print(ab.count(h))

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


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


if __name__ == "__main__":
    main()

Solution (Python):
N, M = map(int, input().split())
a = sum([list(map(int, input().split())) for _ in range(M)], [])
for n in range(1, N+1):
  print(a.count(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 a in A:
    
    print(a)

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

ans = [0 for _ in range(N)]

for m in range(M):
  ans[ab[m][0]-1] += 1
  ans[ab[m][1]-1] += 1

for a in ans:
  print(a)

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

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

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

tmp = [0] * N

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

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

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

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

print("\n".join([str(s) for s in ans]))

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

for ci in c:
    print(ci)

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

Solution (Python):
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, m = inintm()

city = [0]*(n+1)

for _ in range(m):
    a, b = inintm()
    city[a] += 1
    city[b] += 1

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

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())
abl=[list(map(int,input().split())) for _ in range(m)]

ans=[0]*n
for ab in abl:
    ans[ab[0]-1]+=1
    ans[ab[1]-1]+=1

for i in ans:
    print(i)

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

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)

C=[0]*(N+1)

for i in range(M):
    C[A[i]]+=1
    C[B[i]]+=1

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

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

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


def read():
    N, M = map(int, input().strip().split())
    AB = []
    for i in range(M):
        a, b = map(int, input().strip().split())
        AB.append((a-1, b-1))
    return N, M, AB


def solve(N, M, AB):
    n_neighbors = [0 for i in range(N)]
    for a, b in AB:
        n_neighbors[a] += 1
        n_neighbors[b] += 1
    for x in n_neighbors:
        print(x)


if __name__ == '__main__':
    inputs = read()
    solve(*inputs)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

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

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

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

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

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

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

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

Solution (Python):
n,m=map(int,input().split())
ans=[0 for _ in range(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())
pairs = []
res = []
for _ in range(m):
	pair = list(map(int, input().split()))
	pairs.append(pair)
for i in range(1, n+1):
	c = 0
	for j in pairs:
		if i in j:
			c += 1
	res.append(c)
for i in res:
	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 j in range(N):
    print(ans[j])

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
print(*cnt)

Solution (Python):
N,M = (int(T) for T in input().split())
Road = []
for TM in range(0,M):
    Road.extend([int(T) for T in input().split()])
for TN in range(1,N+1):
    print(Road.count(TN))

Solution (Python):
N,M=map(int,input().split())
ans=[0 for i in range(N)]
for j 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 = 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(1,N + 1):
    print(A.count(i))

Solution (Python):

















import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
ans = [0 for _ in range(N)]
for i in range(M):
    a, b = MAP()
    ans[a - 1] += 1
    ans[b - 1] += 1

for a in ans:
    print(a)

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

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

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

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

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

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

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

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

for v in lst:
    print(len(v))

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

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

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





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    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 power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


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)

    divisors.sort()
    return divisors


inf = 10 ** 18
mod = 10 ** 9 + 7

n,m = lr()
count = [[0 for i in range(n)] for h in range(n)]
for i in range(m):
    a,b  = lr()
    a-=1
    b-=1
    a,b = min(a,b), max(a,b)
    count[a][b] += 1
    count[b][a] += 1
for i in range(n):
    print(sum(count[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 = [int(x) for x in input().split()]
ans = [0] * n
for _ in range(m):
    a, b = [int(x) - 1 for x in input().split()]
    ans[a] += 1
    ans[b] += 1
print("\n".join([str(x) for x in ans]))

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

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M, *AB = map(int, read().split())
    ans = [0] * N
    for a, b in zip(*[iter(AB)] * 2):
        ans[a - 1] += 1
        ans[b - 1] += 1

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

    return


if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

Solution (Python):
from collections import defaultdict

n,m=map(int,input().split())
r=[list(map(int,input().split())) for _ in range(m)]
d=defaultdict(int)
for x in r:
  d[x[0]]+=1
  d[x[1]]+=1

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

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())
for i in range(N):print(a.count(i+1)+b.count(i+1))

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

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

for v in res:
  print(v)

Solution (Python):
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

N,M = MI()
from collections import defaultdict

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

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

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

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

for r in routes:
  print(r)

Solution (Python):

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

Solution (Python):
n, m = map(int, input().split())
k = [i for i in range(1, n + 1)]
v = [0] * n
d = dict(zip(k, v))

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

for x in d.values():
    print(x)

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

Solution (Python):
n, m = map(int, input().split())
g = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    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 = input().split(' ')
N = int(N)
M = int(M)
citys = []
for i in range(M):
  a, b = input().split(' ')
  a = int(a)
  b = int(b)
  citys.append(a)
  citys.append(b)
for i in range(1, N+1):
  print(citys.count(i))

Solution (Python):
def INT():
    return int(input())

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

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

N, M = MI()
city = [[] for _ in range(N)]

for _ in range(M):
    a, b = MI()
    city[a - 1].append(b - 1)
    city[b - 1].append(a - 1)
    
for c in city:
    print(len(c))

Solution (Python):
n, m = map(int, input().split())                    
route_lists = [input().split() for i in range(m)]   
new_lists = []                                      
for i in route_lists:                               
  for j in range(2):                                
    new_lists.append(i[j])                          
                                                                                      
for i in range(1, n+1, 1):                          
  print(new_lists.count(str(i)))

Solution (Python):
n, m = map(int, input().split())                    
route_lists = [input().split() for i in range(m)]   
new_lists = []                                      
for i in route_lists:                               
  for j in range(2):                                
    new_lists.append(i[j])                          
                                                    
new_lists.sort()                                    
for i in range(1, n+1, 1):                          
  print(new_lists.count(str(i)))

Solution (Python):
N,_,*L=map(int,open(0).read().split())
for n in range(N):print(L.count(n+1))

Solution (Python):
N,_,*L=map(int,open(0).read().split())
A=[0]*N
for l in L: A[l-1]+=1
print(*A,sep='\n')

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

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

tmp = sorted(Road)


ans = [0]*n
for t in tmp:
  ans[t[0]-1] += 1
  ans[t[1]-1] += 1

for a in ans:
  print(a)

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

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

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

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

node_num = {str(i): 0 for i in range(1, n + 1)}
for node in nodes:
    node_num[node[0]] += 1
    node_num[node[1]] += 1

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

Solution (Python):
MM = input().split()
N = int(MM[0])
M = int(MM[1])
list1 = []
for i in range(M):
  aa = input().split()
  a = int(aa[0])
  b = int(aa[1])
  list1.append(a)
  list1.append(b)
for i in range(1,N+1):
  ans = list1.count(i)
  print(ans)

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

Solution (Python):
N,M = map(int,input().split())
c = []
for i in range(M):
  c.extend(list(map(int,input().split())))
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())
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):
n,m = map(int,input().split())
tmp=[]
for _ in range(m):
    tmp.append(list(map(int,input().split())))
for i in range(1,n+1):
    print(sum(j.count(i) for j in tmp))

Solution (Python):
s = input().split()

n = int(s[0])
m = int(s[1])

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


for i in range(m):
    p = input().split()
    x = int(p[0])
    y = int(p[1])
    citys[x - 1] += 1
    citys[y - 1] += 1

for i in range(len(citys)):
    print(citys[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 j in range(n):
    print(lis[j])