#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int maxn = 2505;
const int maxm = 50010;
const int INF = 0x3f3f3f3f;
struct node {
  int ne, to;
} e[maxm << 1];
int cnt = 0, n, m, nume, he[maxn], sz[maxn], f[maxn][maxn][3][3], up[maxn];
int vis[maxn];
inline void add(int p, int q) {
  e[++nume].ne = he[p];
  e[nume].to = q;
  he[p] = nume;
}
void dp1(int u, int fa) {
  vis[u] = 1;
  sz[u] = 1;
  f[u][0][0][0] = f[u][1][1][0] = 0;
  f[u][0][2][0] = 1;
  for (int w = he[u]; w; w = e[w].ne) {
    int v = e[w].to;
    if (v == fa || vis[v] == 2)
      continue;
    else if (!vis[v]) {
      dp1(v, u);
      sz[u] += sz[v];
      if (up[v] && up[v] != u) up[u] = up[v];
      for (int i = sz[u]; i >= 0; --i) {
        for (int stau = 0; stau <= 2; stau++)
          for (int c = 2; c >= 0; c--) {
            int maxx = -INF;
            for (int j = max(0, i + sz[v] - sz[u]); j <= sz[v]; ++j) {
              if (i < j) break;
              for (int stav = 0; stav <= 2; stav++) {
                if (stau + stav == 3) continue;
                if (up[v] == u)
                  maxx = max(maxx, f[u][i - j][stau][c] + f[v][j][stav][stau]);
                else if (up[v])
                  maxx = max(maxx, f[u][i - j][stau][0] + f[v][j][stav][c]);
                else
                  maxx = max(maxx, f[u][i - j][stau][c] + f[v][j][stav][0]);
              }
            }
            f[u][i][stau][c] = maxx;
          }
      }
    } else {
      up[u] = v;
      for (int i = 0; i <= sz[u]; i++) {
        f[u][i][1][2] = f[u][i][2][1] = -INF;
        f[u][i][1][1] = f[u][i][1][0];
        f[u][i][2][2] = f[u][i][2][0];
        f[u][i][0][1] = f[u][i][0][0];
        f[u][i][0][2] = f[u][i][0][0];
      }
    }
  }
  vis[u] = 2;
}
void dp(int u, int fa) {
  vis[u] = 1;
  sz[u] = 1;
  f[u][0][0][0] = f[u][1][1][0] = 0;
  f[u][0][2][0] = 1;
  int maxx;
  for (int h = he[u]; h != 0; h = e[h].ne) {
    int v = e[h].to;
    if (v == fa || vis[v] == 2) continue;
    if (vis[v] == 0) {
      dp(v, u);
      sz[u] += sz[v];
      if (up[v] && up[v] != u) up[u] = up[v];
      for (int i = sz[u]; i >= 0; i--) {
        for (int a = 0; a <= 2; ++a)
          for (int c = 2; c >= 0; c--) {
            maxx = -INF;
            for (int j = max(0, i + sz[v] - sz[u]); j <= sz[v]; ++j) {
              if (i < j) break;
              for (int b = 0; b < 3; ++b) {
                if (a + b == 3) continue;
                if (up[v] == u)
                  maxx = max(maxx, f[u][i - j][a][c] + f[v][j][b][a]);
                else if (up[v])
                  maxx = max(maxx, f[u][i - j][a][0] + f[v][j][b][c]);
                else
                  maxx = max(maxx, f[u][i - j][a][c] + f[v][j][b][0]);
              }
            }
            f[u][i][a][c] = maxx;
          }
      }
    } else {
      up[u] = v;
      for (int i = 0; i <= sz[u]; ++i) {
        f[u][i][1][1] = f[u][i][1][0];
        f[u][i][2][2] = f[u][i][2][0];
        f[u][i][0][1] = f[u][i][0][0];
        f[u][i][0][2] = f[u][i][0][0];
        f[u][i][1][2] = f[u][i][2][1] = -INF;
      }
    }
  }
  vis[u] = 2;
}
int main() {
  memset(he, 0, sizeof(he));
  memset(up, 0, sizeof(up));
  memset(f, 0xcf, sizeof(f));
  scanf("%d", &n);
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v);
    add(v, u);
  }
  dp(1, -1);
  int ans;
  for (int i = 0; i <= n; ++i) {
    ans = -INF;
    for (int j = 0; j < 3; ++j) ans = max(ans, f[1][i][j][0]);
    printf("%d ", ans);
  }
  putchar('\n');
}

### Prompt

Please create a solution in CPP to the following problem:

Jack and Jill are tired of the New Year tree, now they've got a New Year cactus at home! A cactus is a connected undirected graph where any two simple cycles have at most one common vertex. In other words, this graph doesn't have any edges that lie on more than one simple cycle.

On the 31st of December they are going to decorate the cactus by hanging toys to its vertices. At most one toy is going to hang on each vertex — it's either the toy Jack hung or the toy Jill hung. It's possible for a vertex to have no toys.

Jack and Jill has been arguing, so they don't want any edge to connect two vertices where one vertex has Jack's toy and the other vertex has Jill's toy.

Jack has decided to hang a toys. What maximum number of toys b can Jill hang if they both cooperate to maximize this value? Your task is to write a program that finds the sought b for all a from 0 to the number of vertices on the New Year Cactus.

Input

The first line contains two integers n and m (1 ≤ n ≤ 2500, n - 1 ≤ m) — the number of vertices and the number of edges, correspondingly. The next m lines contain two integers a, b each (1 ≤ a, b ≤ n, a ≠ b) that mean that there is an edge connecting vertices a и b. Any pair of vertices has at most one edge between them.

Output

The first line must contain space-separated ba (for all 0 ≤ a ≤ n) where ba equals the maximum number of Jill's toys on the cactus considering that it has a Jack's toys. Numbers ba go in the order of increasing a.

Examples

Input

1 0


Output

1 0 


Input

16 20
1 2
3 4
5 6
6 7
7 8
9 10
10 11
11 12
13 14
15 16
1 5
9 13
14 10
10 6
6 2
15 11
11 7
7 3
16 12
8 4


Output

16 13 12 12 10 8 8 7 6 4 4 3 3 1 0 0 0 

Note

The cactus from the second example is:

<image>

### Response

```cpp
#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int maxn = 2505;
const int maxm = 50010;
const int INF = 0x3f3f3f3f;
struct node {
  int ne, to;
} e[maxm << 1];
int cnt = 0, n, m, nume, he[maxn], sz[maxn], f[maxn][maxn][3][3], up[maxn];
int vis[maxn];
inline void add(int p, int q) {
  e[++nume].ne = he[p];
  e[nume].to = q;
  he[p] = nume;
}
void dp1(int u, int fa) {
  vis[u] = 1;
  sz[u] = 1;
  f[u][0][0][0] = f[u][1][1][0] = 0;
  f[u][0][2][0] = 1;
  for (int w = he[u]; w; w = e[w].ne) {
    int v = e[w].to;
    if (v == fa || vis[v] == 2)
      continue;
    else if (!vis[v]) {
      dp1(v, u);
      sz[u] += sz[v];
      if (up[v] && up[v] != u) up[u] = up[v];
      for (int i = sz[u]; i >= 0; --i) {
        for (int stau = 0; stau <= 2; stau++)
          for (int c = 2; c >= 0; c--) {
            int maxx = -INF;
            for (int j = max(0, i + sz[v] - sz[u]); j <= sz[v]; ++j) {
              if (i < j) break;
              for (int stav = 0; stav <= 2; stav++) {
                if (stau + stav == 3) continue;
                if (up[v] == u)
                  maxx = max(maxx, f[u][i - j][stau][c] + f[v][j][stav][stau]);
                else if (up[v])
                  maxx = max(maxx, f[u][i - j][stau][0] + f[v][j][stav][c]);
                else
                  maxx = max(maxx, f[u][i - j][stau][c] + f[v][j][stav][0]);
              }
            }
            f[u][i][stau][c] = maxx;
          }
      }
    } else {
      up[u] = v;
      for (int i = 0; i <= sz[u]; i++) {
        f[u][i][1][2] = f[u][i][2][1] = -INF;
        f[u][i][1][1] = f[u][i][1][0];
        f[u][i][2][2] = f[u][i][2][0];
        f[u][i][0][1] = f[u][i][0][0];
        f[u][i][0][2] = f[u][i][0][0];
      }
    }
  }
  vis[u] = 2;
}
void dp(int u, int fa) {
  vis[u] = 1;
  sz[u] = 1;
  f[u][0][0][0] = f[u][1][1][0] = 0;
  f[u][0][2][0] = 1;
  int maxx;
  for (int h = he[u]; h != 0; h = e[h].ne) {
    int v = e[h].to;
    if (v == fa || vis[v] == 2) continue;
    if (vis[v] == 0) {
      dp(v, u);
      sz[u] += sz[v];
      if (up[v] && up[v] != u) up[u] = up[v];
      for (int i = sz[u]; i >= 0; i--) {
        for (int a = 0; a <= 2; ++a)
          for (int c = 2; c >= 0; c--) {
            maxx = -INF;
            for (int j = max(0, i + sz[v] - sz[u]); j <= sz[v]; ++j) {
              if (i < j) break;
              for (int b = 0; b < 3; ++b) {
                if (a + b == 3) continue;
                if (up[v] == u)
                  maxx = max(maxx, f[u][i - j][a][c] + f[v][j][b][a]);
                else if (up[v])
                  maxx = max(maxx, f[u][i - j][a][0] + f[v][j][b][c]);
                else
                  maxx = max(maxx, f[u][i - j][a][c] + f[v][j][b][0]);
              }
            }
            f[u][i][a][c] = maxx;
          }
      }
    } else {
      up[u] = v;
      for (int i = 0; i <= sz[u]; ++i) {
        f[u][i][1][1] = f[u][i][1][0];
        f[u][i][2][2] = f[u][i][2][0];
        f[u][i][0][1] = f[u][i][0][0];
        f[u][i][0][2] = f[u][i][0][0];
        f[u][i][1][2] = f[u][i][2][1] = -INF;
      }
    }
  }
  vis[u] = 2;
}
int main() {
  memset(he, 0, sizeof(he));
  memset(up, 0, sizeof(up));
  memset(f, 0xcf, sizeof(f));
  scanf("%d", &n);
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v);
    add(v, u);
  }
  dp(1, -1);
  int ans;
  for (int i = 0; i <= n; ++i) {
    ans = -INF;
    for (int j = 0; j < 3; ++j) ans = max(ans, f[1][i][j][0]);
    printf("%d ", ans);
  }
  putchar('\n');
}

```