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
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(1000000)



def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))



def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


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


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v



def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk



def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False



dp = None


def main():
    N, M = li_input()
    R = [0] * (N+1)
    
    for i in range(M):
        a, b = li_input()
        R[a] += 1
        R[b] += 1

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



main()

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N, M = map(int, input().split())
    d = defaultdict(list)
    for _ 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]))


if __name__ == '__main__':
    main()

Solution (Python):
import collections

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


temp = []
for i in range(m):
    tempa,tempb = map(int,input().split())
    temp.append(tempa)
    temp.append(tempb)
temp.sort()
temp_count = collections.Counter(temp)

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

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

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):
  k = 0
  for j in range(M):
    if (L[j][0] == i):
      k += 1
    elif (L[j][1] == i):
      k += 1
    else:
      k += 0
  print(k)

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)

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

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

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

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

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

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

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

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

n,m = li()

cnt = [0]*51

for _ in range(m):
    a,b = li()
    cnt[a] += 1
    cnt[b] += 1
    
for i in range(1,n+1):
    print(cnt[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 a in ans:
    print(a)

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

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

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

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

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

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

Solution (Python):


n, m = map(int, input().split())
l = []
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())

Cnt = [0] * N

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

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

Solution (Python):
from collections import Counter
N,M=map(int, input().split())
A=[]
for i in range(M):
    tmp=list(map(int, input().split()))
    A.append(tmp[0])
    A.append(tmp[1])
Acnt=dict(Counter(A).items())
for i in range(1,N+1):
    if i in Acnt:
        print(Acnt[i])
    else:
        print(0)

Solution (Python):
from collections import defaultdict

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

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

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

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

road = []

for _ in range(M):
    road += list(map(int, input().split()))

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

Solution (Python):
import sys

n,m = (int(_) for _ in input().split())

city = [0]*n
for i in range(m):
    x,y = (int(_) for _ in input().split())
    city[x-1] += 1
    city[y-1] += 1

for i in city:
    print(i)

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

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

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

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

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

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

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

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

ans=[]
for i in range (N):
    count=0
    for j in range (M):
        if i+1 == data[j][0] or i+1== data[j][1]:
            count+=1
    ans.append(count)

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

Solution (Python):


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

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

    for _ in range(m):
        lists += input().split()
    
    for i in range(1, n + 1):
        print(lists.count(str(i)))


solve()

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

Solution (Python):
n, m = list(map(int, input().split()))
ans = dict(zip(range(1, n+1), [0]*n))
for _ in range(m):
    a, b = list(map(int, input().split()))
    ans[a] += 1
    ans[b] += 1

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

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

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

Solution (Python):


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

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

if __name__ == '__main__':
    main()

Solution (Python):
a,b=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(b)]
for j in range(1,a+1):
    print(sum(1 for i in l if i[0]==j or i[1]==j))

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

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

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

Solution (Python):
n,m=map(int,input().split())
res=[0 for _ in range(n)]
for _ in range(m):
    a,b=map(int,input().split())
    res[a-1]+=1
    res[b-1]+=1
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())
	a -= 1
	b -= 1
	ans[a] += 1
	ans[b] += 1

for aa in ans:
	print(aa)

Solution (Python):
import sys

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

roads_count = [0 for i in range(n)]
for a_i, b_i in ab:
    if a_i != b_i:
        roads_count[a_i-1] += 1
        roads_count[b_i-1] += 1
[print(num) for num in roads_count]

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

Solution (Python):
a,b=map(int,input().split())

ans=[0]*a

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

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

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

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

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

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

count = []

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

for i in range(m):
  a, b = list(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())

A = {}
for i in range(1, n+1):
    A[i] = 0
for i in range(m):
    data = list(map(int, input().split()))
    A[data[0]] += 1
    A[data[1]] += 1

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

Solution (Python):
from collections import defaultdict
N, M = map(int, input().split())
d = defaultdict(int)
for i 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())
a = {i:0 for i in range(1,N + 1)}
for i in range(M):
    x,y = map(int,input().split())
    a[x] += 1
    a[y] += 1

ans = list(a.values())
for i in ans:
    print(i)

Solution (Python):


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


cities = [0 for i in range(N)]


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


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

Solution (Python):

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

for i in range(1, N + 1):
    ans = 0
    for j in range(M):
        if i in R[j]:
            ans += 1
    print(ans)

Solution (Python):
n,m = map(int, input().split())
ab = []
for _ in range(m):
    ab.append(list(map(int, input().split())))
ans = {}
for i in range(1, n+1):
    ans.update({i : 0})
for i in range(m):
    for j in range(2):
        if ab[i][j] in ans:
            ans[ab[i][j]] += 1
for v in ans.values():
    print(v)

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

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

for val in num:
    print(val)

Solution (Python):
from collections import Counter

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

for i in range(1, N+1):
        input_counter[int(i)] = 0

for j in range(M):
    for i in input().split():
        input_counter[int(i)] += 1

for element in input_counter.keys():
    print(input_counter[element])

Solution (Python):
N,M=map(int,raw_input().split())
r=[0]*N
for i in xrange(M):
  ai,bi=map(int,raw_input().split())
  r[ai-1] += 1
  r[bi-1] += 1
for ri in r:
  print ri

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(i) for i in input().split()]
a = [0 for i in range(n)]
for i in range(m):
    u, v = [int(j) for j in input().split()]
    a[u - 1] += 1
    a[v - 1] += 1

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

Solution (Python):
n,m=map(int,input().split())
s=' '.join([input() for _ in [0]*m])
for i in range(1,n+1):print(s.split().count(str(i)))

Solution (Python):
from collections import Counter

N, M = map(int, input().split())
cnt = Counter()
for _ in range(M):
  cnt.update(list(map(int, input().split())))

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

Solution (Python):
import sys
from collections import defaultdict
N, M = map(int, sys.stdin.readline().strip().split())
res = defaultdict(int)
for i in range(M):
    a, b = map(int, sys.stdin.readline().strip().split())
    a -= 1
    b -= 1
    res[a] += 1
    res[b] += 1
for i in range(N):
    print(res[i])

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

for a,b in c:
    result[a-1] += 1
    result[b-1] += 1

for i in result:
    print(i)

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

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

for a, b in AB:
    result[a-1] += 1
    result[b-1] += 1

for i in result:
    print(i)

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


for i in range(1, N+1):
    res = 0
    for j in range(M):
        if i in cities[j]:
            res += 1
    print(res)

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

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

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

for i in range(M):
    roads.append(list(map(int, input().split())))

for i in range(M):
    city1 = roads[i][0]
    city2 = roads[i][1]
    cities[city1-1] += 1
    cities[city2-1] += 1

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

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

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

V=[0]*(N)

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

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

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

Solution (Python):

lister = []
backet = {}

first_input = input().split(" ")

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


for j in range(M):
    two_input = input().split(" ")
    lister.append(int(two_input[0]))
    lister.append(int(two_input[1]))


order = range(1,N+1,1)



for j in order:
    backet[j]=0


for i in lister:
    value = backet[i]
    value += 1
    
    backet[i] = value



for m in order:
    print(backet[m])

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

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

a = 0
b = 0

ways = N*[0]

for i in range(M):
    a,b = (int(k) for k in input().split())
    for j in range(1,N+1):
        if (a==j or b==j):
            ways[j-1] = ways[j-1] + 1

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

Solution (Python):
from collections import Counter

N, M = map(int, input().split())
c = Counter(' '.join([input() for i in range(M)]).split())

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

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

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

A_list=[]
B_list=[]
for m in range(NM_list[1]):
	ab=input().split()
	AB_list = list(map(int,ab))
	A_list.append(AB_list[0])
	B_list.append(AB_list[1])

n_list=[]
for n in range(1,NM_list[0]+1):
	n_list.append(0)


for i in range(1,len(A_list)+1):
	for n_len in range(1,len(n_list)+1):
		if(n_len == A_list[i-1]):
			n_list[n_len-1] += 1
			break

for i in range(1,len(B_list)+1):
	for n_len in range(1,len(n_list)+1):
		if(n_len == B_list[i-1]):
			n_list[n_len-1] += 1
			break

for p in range(1,NM_list[0]+1):
	print(n_list[p-1])

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

A_list=[]
B_list=[]
for m in range(NM_list[1]):
	ab=input().split()
	AB_list = list(map(int,ab))
	A_list.append(AB_list[0])
	B_list.append(AB_list[1])

n_list=[]
for n in range(1,NM_list[0]+1):
	n_list.append(0)


for i in range(1,len(A_list)+1):
	for n_len in range(1,len(n_list)+1):
		if(n_len == A_list[i-1]):
			n_list[n_len-1] += 1
			break

for i in range(1,len(B_list)+1):
	for n_len in range(1,len(n_list)+1):
		if(n_len == B_list[i-1]):
			n_list[n_len-1] += 1
			break

for p in range(1,NM_list[0]+1):
	print(n_list[p-1])

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

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

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

Solution (Python):
N, M = list(map(int, input().split()))
array= [0] * (N+1)

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

for j in range(0, N):
    print(array[j+1])

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

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

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

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

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

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

for p in A:
    R[p[0]-1] += 1
    R[p[1]-1] += 1

for c in R:
    print(c)

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

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

for l in line:
  print(l)

Solution (Python):
N, M = map(int, input().split(' '))
road = [list(map(int, input().split(' '))) for _ in range(M)]
road_num = [0] * N
for r in road:
    road_num[r[0] - 1] += 1
    road_num[r[1] - 1] += 1
for num in road_num:
    print(num)

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

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

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

Solution (Python):
from collections import Counter


def getinputdata():
    
    array_result = []

    data = input()

    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if (data != ""):

                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:

        return array_result


arr_data = getinputdata()

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

arr = []

for i in range(1, 1 + m):
    arr.append(int(arr_data[i][0]))
    arr.append(int(arr_data[i][1]))

list01 = Counter(arr)


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

Solution (Python):
n,m=map(int,input().split());a=[]
for _ in[0]*m:a+=input().split()
for x in range(n):print(a.count(str(-~x)))

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

Solution (Python):
N, M = map(int, raw_input().split())
roadlist = []
for i in range(0, N):
	town = []
	for j in range(0, N):
		town.append(0)
	roadlist.append(town)

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

for i in range(0, N):
	cnt = 0
	for j in range(0, N):
		cnt = cnt + roadlist[i][j]
	print cnt

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

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

Solution (Python):
from collections import defaultdict

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

R = {}
for i in range(N):
    R[i+1]=0

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

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

Solution (Python):
def inpl(): return map(int, input().split())
N, M = inpl()
t = []
for i in range(N):
    t.append(0)
for i in range(M):
    a, b = inpl()
    t[a-1] += 1
    t[b-1] += 1
    
for i in t:
    print(i)

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

Solution (Python):
from collections import defaultdict

n, m = map(int, input().split())
count = defaultdict(int)
for _ in range(m):
    c1, c2 = map(int, input().split())
    count[c1] += 1
    count[c2] += 1
for i in range(1, n + 1):
    print(count[i])

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

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

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

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

Solution (Python):





if __name__ == '__main__':
    city_count, road_count = map(int, input().split())
    a = list()
    b = list()

    for _ in range(road_count):
        line = input().split()
        a.append(line[0])
        b.append(line[1])

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

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

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

Solution (Python):
from collections import defaultdict
import pprint

N, M = [int(s) for s in input().split()]

citydict = defaultdict(list)

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

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

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

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

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

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

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

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

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

road=[0for i in range(N)]
for i in range(M):
    road[ai[i]-1]+=1
    road[bi[i]-1]+=1
for i in range(N):
    print(road[i])

Solution (Python):
def solve():
    path_dict = {}
    N, M = list(map(int, input().split(" ")))
    for i in range(M):
        a, b = list(map(int, input().split(" ")))
        if a in path_dict.keys():
            path_dict[a] += 1
        else:
            path_dict[a] = 1
        if b in path_dict.keys():
            path_dict[b] += 1
        else:
            path_dict[b] = 1
    for i in range(1,N+1):
        if i in path_dict.keys():
            print(path_dict[i])
        else:
            print(0)
    
solve()

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

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

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

    d[a] += 1
    d[b] += 1

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