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

Solution (Python):
n, m = map(int, input().split())
r = [0] * n
for _ 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())
ab=[]
for i in range(m):
	ab.extend(list(map(int,input().split())))
for i in range(1,n+1):
	print(ab.count(i))

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())
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):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")









N, M = list(map(int, sys.stdin.readline().split()))
A, B = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(M)]))

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

Solution (Python):
city_num, road_num = tuple(int(i) for i in input().split(" "))
city_road_list = [0 for i in range(city_num)]
for i in range(road_num):
    city_1, city_2 = tuple(int(i) for i in input().split(" "))
    city_road_list[city_1 - 1] += 1
    city_road_list[city_2 - 1] += 1
for i in city_road_list:
    print(i)

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

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

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

ans = []
for _ in range(m):
    ans += list(input().split())

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

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

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())
from collections import defaultdict
dic = defaultdict(lambda: 0)
for i in range(m):
    a, b = [int(j) for j in input().split()]
    dic[int(a)] += 1
    dic[int(b)] += 1

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

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

deg = [0] * (N+1)

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

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

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

for i in ab:
    print(a.count(i) + b.count(i))

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

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

for e in E[1:]:
    print(len(e))

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

ans = list(set(road))
ans.sort()
for i in range(1,n+1):
  print(road.count(i))

Solution (Python):
n,m = map(int,input().split())
li = []
for i in range(m):
    li.append(list(map(int,input().split())))
cnt = []    
for i in range(n):
    num = 0 
    for j in range(m):
        if li[j][0] == i+1 or li[j][1] == i+1:
            num += 1
    cnt.append(num)
for i in cnt:
    print(i)

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

way=[]

for i in range(n):
    way.append(list(map(int,input().split())))

city=[]
for j in range(1,m+1):
    city.append(j)




for k in city:
    cnt=0
    for l in way:
        for m in range(len(l)):
            if k==l[m]:
                cnt+=1
    print(cnt)

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

ans=[0]*(N+1)
for _ 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())
cities = [list(map(int, input().split())) for _ in range(M)]

roads = [0] * N
for city in cities:
  roads[city[0] - 1] += 1
  roads[city[1] - 1] += 1

for road in roads:
  print(road)

Solution (Python):

n, k = map(int, input().split())
o = []
for i in range(k):
    t = list(map(int, input().split()))
    o += t

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

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

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

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

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

from collections import defaultdict

d = defaultdict(int)

for j in a:
    d[j] +=1
for k in b:
    d[k] +=1

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

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

Solution (Python):


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

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

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

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

for i in ar:
    print(i)

Solution (Python):
N, M = map(int, input().split())
roads = []
for i in range(0, N):
	roads.append([])
for i in range(0, M):
	a, b = map(lambda v: int(v)-1, input().split())
	roads[a].append(b)
	roads[b].append(a)
for i in range(0, N):
	print(len(roads[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())
bri_join = [[i for i in map(int,input().split())] for j in range(m)]
ans = {} 
for i in range(n):
    ans[i+1] = 0 
    for j in range(m):
        if i+1 in bri_join[j]:
            ans[i+1] += 1
    print(ans[i+1])

Solution (Python):


import itertools
import collections
import bisect

def main():
    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 a in ans:
        print(a)

if __name__ == '__main__':
    main()

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


for i in range(1,N+1):
    road = 0
    for a,b in ab:
        if a == i:
            road += 1
        if b == i:
            road += 1
    print(road)

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

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

for i in ab:
    print(a.count(i) + b.count(i))

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

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

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

ans = [0 for i in range(N+1)]
for i in range(M):
    ans[ab[i][0]]+=1
    ans[ab[i][1]]+=1
    
    
for i in range(1,len(ans)):
    print(ans[i])

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

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

ANS=[0]*(N+1)
for a,b in R:
    ANS[a]+=1
    ANS[b]+=1

for ans in ANS[1:]:
    print(ans)

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

ans = [0] * N

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

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

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

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

Solution (Python):
import math





city_road = list(map(int, input().split())) 
arr = [0]*city_road[1]
for i in range(city_road[1]):
    arr[i] = list(map(int, input().split())) 

count = [0]*city_road[0]
for j in range(city_road[0]):
    for i in range(city_road[1]):
        if j+1 in arr[i]:
            count[j] += 1

for i in range(city_road[0]):
    print(count[i])

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
print(*c, sep='\n')

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

for i,j in Loads:
    ans[i-1] += 1
    ans[j-1] += 1

for i in ans:
    print(i)

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

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

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

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

for i in range(n):
    count = 0
    for j in range(m):
        count += l[j].count(str(i+1))
    print(count)

Solution (Python):
city,road = map(int,input().split())
spot_list = [list(map(int,input().split())) for i in range(road)]
road_list = []

for i in range(road):
    spot = spot_list[i]
    for j in range(2):
        road_list.append(spot[j])

for k in range(1,city+1):
    count = 0
    for l in range(road*2):
        if k == road_list[l]:
            count += 1
    print(count)

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

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

ans=[0]*n
for i in range(m):
  ans[lst[i][0]-1] += 1
  ans[lst[i][1]-1] += 1
for i in range(n):
  print(ans[i])

Solution (Python):




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


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

Solution (Python):

"""解き方
[入力例1]
4 3
1 2
2 3
1 4

道路\都市 | 1 | 2 | 3 | 4
           ○   ○ 
               ○   ○
           ○           ○

[出力例1]
2
2
1
1
"""
def solve():
    N, M = list(map(int, input().split()))
    road_cnt = [0 for i in range(N)]

    for i in range(M):
        a, b = list(map(int, input().split()))
        a, b = a-1, b-1

        road_cnt[a] += 1
        road_cnt[b] += 1
    
    for cnt in road_cnt:
        print(cnt)


if __name__ == "__main__":
    solve()

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

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

Solution (Python):
N, M = map(int, input().split())
ans = [0] * N
for x, y in [list(map(int, input().split())) for i in range(M)]:
    ans[x-1] += 1
    ans[y-1] += 1
print("\n".join(map(str, ans)))

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

for j in range(1,N+1):
  ans = 0
  for k in range(M):
    a = lst1[k].count(j)
    
    ans += a
  print(ans)

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

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

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

Solution (Python):
from sys import stdin
N, M = [int(_) for _ in stdin.readline().rstrip().split()]
AB = [list(map(int, stdin.readline().rstrip().split())) for _ in range(M)]
ans = [0]*N
for r in AB:
    for c in r:
        ans[c-1] += 1
print(*ans, sep='\n')

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

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

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

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

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

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

for _ in range(M):
    l, r = map(int, input().split())
    cnts[l] += 1
    cnts[r] += 1

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

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

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


ab = []
for _ in range(M):
  ab.append(list(map(int, input().split())))
  
           
bridges = [0] * N
            
for c in range(N):
  for i in range(M):
    if c+1==ab[i][0] or c+1==ab[i][1]:
      bridges[c] += 1
            
 
for _ in range(N):
  print(bridges[_] )

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

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

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

Solution (Python):
from collections import deque, Counter
N, M = map(int, input().split())
X = deque(maxlen=2 * M)
for _ in range(M):
    a, b = input().split()
    X.append(a)
    X.append(b)
c = Counter(X)
for i in range(1, N+1):
    i = str(i)
    print(c[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 = map(int,input().split())
l = []
for i in range(m):
    a,b = map(int,input().split())
    l.append(a)
    l.append(b)
for i in range(1,n+1):
    print(l.count(i))

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

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

city = [0] * N

for i in range(M):
    tmp1, tmp2 = map(int,input().split())
    city[tmp1-1] += 1
    city[tmp2-1] += 1
for i in range(N):
    print(city[i])

Solution (Python):


import sys
import collections
input = sys.stdin.readline

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


def main():
    ctr = collections.Counter(a + b)
    for i in range(1, N+1):
        print(ctr[i])


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


class Node():

    def __init__(self):
        self.idx = None
        self.left = None
        self.right = None
        self.parent = None
        return

    def pre_order(self):
        global pre_order_str
        pre_order_str += str(self.idx) + " "
        if self.left:
            self.left.pre_order()

        if self.right:
            self.right.pre_order()

    def in_order(self):
        global in_order_str

        if self.left:
            self.left.in_order()

        in_order_str += str(self.idx) + " "

        if self.right:
            self.right.in_order()

    def post_order(self):
        global post_order_str
        if self.left:
            self.left.post_order()

        if self.right:
            self.right.post_order()

        post_order_str += str(self.idx) + " "


class HeapHelper():
    """HeapContrler.
    完全二分木を二分ヒープで表現した配列 A に対して、
    HeapHelper.parent(idx) とするとそのノードの親の添字を返す
    存在しない場合は Falseを返す

    Returns:
        [type] -- [description]
    """

    def __init__(self):
        return

    @staticmethod
    def parent(i):
        if i == 1:
            return False

        return int(i/2)

    @staticmethod
    def left(i):
        l_idx = 2*i
        if H < l_idx:
            return False

        return l_idx

    @staticmethod
    def right(i):
        r_idx = 2*i + 1
        if H < r_idx:
            return False

        return r_idx


if __name__ == "__main__":
    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 i in range(N):
    print(ans[i])

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

for i in range(n):
    for j in range(m):
        if i+1 in a[j]:
            l[i]+=1
for i in range(n):
    print(l[i])

Solution (Python):
def ipt(N=0,switch=0):
    if N == 0:
        return list(map(int,input().split()))
    else:
        if switch==0:
            return [list(map(int,input().split())) for _ in range(N)]
        else:
            return [int(input()) for _ in range(N)]

N,M=ipt()
a=ipt(M)

for i in range(1,N+1):
    ans_list=[]
    for j in range(M):
        if a[j][0] == i:
            ans_list.append(a[j][1])
        if a[j][1] == i:
            ans_list.append(a[j][0])
    print(len(ans_list))

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

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

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

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 x in l:
  print(x)

Solution (Python):
n, m = [int(i) for i in input().split()]
a = []
for i in range(m):
  a.extend([int(i) for i in input().split()])
for i in range(1,n+1):
  print(a.count(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
for d in c:
    print(d)

Solution (Python):

import copy
import random
import bisect 
import fractions 
import math

mod = 10**9+7


N,M = map(int,input().split())
loads = [[0 for i in range(N)]for j in range(N)]
for i in range(M):
    load = [int(i) for i in input().split()]
    loads[load[0]-1][load[1]-1] += 1
    loads[load[1]-1][load[0]-1] += 1

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

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

for i in range(M):
  l.extend(list(map(int, input().split())))
for i in range(1,N+1):
  print(l.count(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 j in range(1,n+1):
    print(l.count(j))

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

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

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

cnt = {x: 0 for x in range(1, n+1)}

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

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

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

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

from itertools import chain
ab = list(chain.from_iterable(ab))
for _ in range(1, N + 1):
    cnt = ab.count(_)
    print(cnt)

Solution (Python):

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

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

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

num = [0] * N

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

for i in num:
    print(i)

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

print('\n'.join(map(str,o)))

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

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

for n in nums.values():
    print(n)

Solution (Python):

n, m = list(map(int, input().rstrip().split()))
lst = [list(map(int, input().rstrip().split())) for _ in range(m)]
ans = [0] * n
for i in lst:
    for j in i:
        ans[j - 1] += 1
for i in ans:
    print(i)

Solution (Python):


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

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

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

Solution (Python):
import sys
from collections import Counter

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

for i in range(len(ab_list)):
    ans_list.append(ab_list[i][0])
    ans_list.append(ab_list[i][1])

ans_cnt = Counter(ans_list)

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

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

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


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

Solution (Python):

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

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

    return n, m, edges

def submit():
    n, m, edges = read_input()

    edges_dic = {}
    for i in  range(n):
        edges_dic[i + 1] = []

    for e in edges:
        (s, t) = e
        edges_dic[s].append(t)
        edges_dic[t].append(s)

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

if __name__ == '__main__':
    submit()

Solution (Python):

N,M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]
ans =[]
for i in range(1,N+1):
    count=0
    for j in range(M):
        if ab[j][0] ==i:
            count +=1
        if ab[j][1] ==i:
            count +=1
    ans.append(count)
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):
N,M = map(int,input().split())
a_list = []
b_list = []
cnt = 0
cnt_list = []
for i in range(M):
    a,b = map(int,input().split())
    a_list.append(a)
    b_list.append(b)
for i in range(1,N+1):
    for j in range(M):
        if i == a_list[j] or i == b_list[j]:
            cnt += 1
    cnt_list.append(cnt)
    cnt = 0
for i in range(len(cnt_list)):
    print(cnt_list[i])

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

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

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

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

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

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

for i in range(M):
  b[a[i][0]-1][a[i][1]-1] += 1
  b[a[i][1]-1][a[i][0]-1] += 1
  
for i in range(N):
  print(sum(b[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] += 1
    cnt[b-1] += 1
for v in cnt:
    print(v)

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

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

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

city = [0] * n

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

for l in city:
    print(l)

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

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

for i in road:
    print(i)

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n, m =f()
    con = [0] * n
    for i in range(m):
        x, y = f()
        con[x-1] += 1
        con[y-1] += 1

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

solve()

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):
from collections import Counter

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

l = []
for i in range(M):
    l.append(AB[i][0])
    l.append(AB[i][1])
cnt = Counter(l)

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

Solution (Python):
nyu=input()
nyu=nyu.split()
N=int(nyu[0])
M=int(nyu[1])
list=[]
for i in range(N):
    list.append(0)
for i in range(M):
    nyu=input()
    nyu=nyu.split()
    a=int(nyu[0])
    b=int(nyu[1])
    list[a-1]+=1
    list[b-1]+=1
for i in range(N):
    print(list[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(1,n+1):
  print(R.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):
  count=0
  for a in A:
    if a[0]==i+1 or a[1]==i+1:
      count+=1
  print(count)

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 j in range(1,n+1):
  c=l.count(j)
  print(c)

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

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

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

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

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