#include using namespace std; template struct Edge { Edge() {} Edge(int to_, T cost_) : to(to_), cost(cost_) {} Edge(int from_, int to_, T cost_) : from(from_), to(to_), cost(cost_) {} Edge(int from_, int to_, T cost_, int idx_) : from(from_), to(to_), cost(cost_), idx(idx_) {} int from, to; T cost; int idx; }; template using Graph = vector>>; using graph = Graph; using edge = Edge; #define add emplace_back int main() { int n, m; cin >> n >> m; graph g(n); for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; u--; v--; g[u].add(v, 1LL); g[v].add(u, 1LL); } if (g[0].size() == 0) { for (int i = 0; i < n; i++) { cout << 0 << endl; } return 0; } vector d(n, -1); d[0] = 0; queue q; q.push(0); while (!q.empty()) { int v = q.front(); q.pop(); for (auto e : g[v]) { int nv = e.to; if (d[nv] != -1) { continue; } d[nv] = d[v] + 1; q.push(nv); } } vector cnt(200010, 0); for (int i = 0; i < n; i++) { if (d[i] >= 0) { cnt[d[i]]++; } } int even = cnt[0], odd = 0; for (int i = 1; i <= n; i++) { if (i % 2 == 0) { even += cnt[i]; cout << even << endl; } else { odd += cnt[i]; cout << odd << endl; } } }