// C #ifndef _GLIBCXX_NO_ASSERT #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if __cplusplus >= 201103L #include #include #include //#include #include #include #include #include #include #endif // C++ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if __cplusplus >= 201103L #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #endif #include using namespace std; using namespace atcoder; template using min_priority_queue = priority_queue, greater>; typedef long long ll; typedef pair P; using mint = modint1000000007; vector dist(int s, vector> &edge) { int n = edge.size(); vector d(n, -1); queue q; d[s] = 0; q.push(s); while (!q.empty()) { int v = q.front(); q.pop(); for (int u : edge[v]) { if (d[u] != -1) continue; d[u] = d[v] + 1; q.push(u); } } return d; } int main() { int n, m; cin >> n >> m; vector> edge(n); for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; u--; v--; edge[u].push_back(v); edge[v].push_back(u); } vector num(n + 1); auto d = dist(0, edge); for (int i = 0; i < n; i++) { num[d[i]]++; } int odd = 0; int even = num[0]; for (int i = 1; i <= n; i++) { if (i % 2 == 1) { odd += num[i]; cout << odd << endl; } else { even += num[i]; cout << even << endl; } } return 0; }