from bisect import bisect_right from collections import deque from itertools import accumulate, filterfalse from math import inf, isinf def main(): N, M = map(int, input().split()) graph = [set() for _ in range(N)] for _ in range(M): u, v = map(lambda n: int(n)-1, input().split()) graph[u].add(v) graph[v].add(u) if not graph[0]: for _ in range(N): print(0) return dist = [inf] * N dist[0] = 0 q = deque([0]) while q: cur = q.popleft() for n in graph[cur]: if dist[n] > dist[cur] + 1: dist[n] = dist[cur] + 1 q.append(n) dist = sorted(filterfalse(isinf, dist)) even_accum = list(accumulate(map(lambda n: int(n % 2 == 0), dist))) for t in range(1, N+1): idx = bisect_right(dist, t) - 1 if t % 2 == 0: print(even_accum[idx]) else: print(idx+1-even_accum[idx]) if __name__ == "__main__": main()