from collections import defaultdict, deque class FenwickTree: def __init__(self, n): self.data = [0] * (n+10) self.n = (n+10) def add(self, p, x): assert 0 <= p < self.n p += 1 while p < len(self.data): self.data[p] += x p += p & -p def sum(self, p): """区間 [0, p] の和""" assert 0 <= p < self.n p += 1 s = 0 while p > 0: s += self.data[p] p -= p & -p return s def rangesum(self, l, r): """区間 [l, r] の和""" assert 0 <= l <= r < self.n s = self.sum(r) if l > 0: s -= self.sum(l-1) return s N, M = map(int, input().split()) adj = defaultdict(list) for _ in range(M): u, v = map(lambda x: int(x)-1, input().split()) adj[u].append(v) adj[v].append(u) def bfs(): evens = FenwickTree(N+10) odds = FenwickTree(N+10) if len(adj[0]) == 0: return evens, odds q = deque([(0, 0)]) # (node, dist) used = set() while q: v, d = q.popleft() if v in used: continue used.add(v) if d % 2 == 0: evens.add(d, 1) else: odds.add(d, 1) for to in adj[v]: if to in used: continue q.append((to, d+1)) return evens, odds evens, odds = bfs() for i in range(1, N+1): if i % 2 == 0: print(evens.sum(i)) else: print(odds.sum(i))