N, M = map(int, input().split()) G = [[] for _ 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) from collections import deque que = deque() visited = [False] * N dist = [10**18] * N stt = 0 visited[stt] = 0 dist[stt] = 0 que.append(stt) while que: now = que.popleft() for to in G[now]: if visited[to] == False: visited[to] = True dist[to] = dist[now] + 1 que.append(to) A = [0] * N for i in range(N): d = dist[i] if d != 10**18: A[d] += 1 S = [] nowodd = 0 noweven = 0 for i in range(N): if i%2 == 0: noweven += A[i] S.append(noweven) else: nowodd += A[i] S.append(nowodd) if i%2 == 0: S.append(nowodd) else: S.append(noweven) print(*S[1:], sep='\n')