Problem: You are given a special connected undirected graph where each vertex belongs to at most one simple cycle.

Your task is to remove as many edges as needed to convert this graph into a tree (connected graph with no cycles). 

For each node, independently, output the maximum distance between it and a leaf in the resulting tree, assuming you were to remove the edges in a way that minimizes this distance.

Input

The first line of input contains two integers n and m (1 ≤ n ≤ 5⋅ 10^5), the number of nodes and the number of edges, respectively.

Each of the following m lines contains two integers u and v (1 ≤ u,v ≤ n, u ≠ v), and represents an edge connecting the two nodes u and v. Each pair of nodes is connected by at most one edge.

It is guaranteed that the given graph is connected and each vertex belongs to at most one simple cycle.

Output

Print n space-separated integers, the i-th integer represents the maximum distance between node i and a leaf if the removed edges were chosen in a way that minimizes this distance.

Examples

Input

9 10
7 2
9 2
1 6
3 1
4 3
4 7
7 6
9 8
5 8
5 9


Output

5 3 5 4 5 4 3 5 4


Input

4 4
1 2
2 3
3 4
4 1


Output

2 2 2 2

Note

In the first sample, a possible way to minimize the maximum distance from vertex 1 is by removing the marked edges in the following image:

<image>

Note that to minimize the answer for different nodes, you can remove different edges.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
vector<int> s[500010];
struct edge {
  int v, nt;
} G[500010 << 2];
int n, m, cnt = 1, h[500010], dfn[500010], low[500010], in[500010], Col,
          w[500010 << 1], q[500010], f[500010];
int clk, col[500010], f1[500010], f2[500010], mx[500010][2], g[500010],
    p[500010], b[500010 << 2], rt[500010], vis[500010];
inline void gmx(int& x, int y) { x < y ? x = y : 0; }
inline void adj(int x, int y) {
  G[++cnt] = (edge){y, h[x]};
  h[x] = cnt;
  G[++cnt] = (edge){x, h[y]};
  h[y] = cnt;
}
inline void tarjan(int x, int p) {
  dfn[x] = low[x] = ++clk;
  for (int v, i = h[x]; i; i = G[i].nt)
    if ((v = G[i].v) != p) {
      if (!dfn[v]) {
        tarjan(v, x);
        if (low[v] == dfn[v] || low[v] > dfn[x]) {
          b[i] = b[i ^ 1] = 1;
        } else
          low[x] = min(low[x], low[v]);
      } else
        low[x] = min(low[x], dfn[v]);
    }
}
inline void color(int x, int p) {
  col[x] = Col;
  s[Col].push_back(x);
  for (int v, i = h[x]; i; i = G[i].nt)
    if (!b[i] && !col[v = G[i].v]) color(v, x);
  for (int v, i = h[x]; i; i = G[i].nt)
    if (b[i] && !col[v = G[i].v]) {
      ++Col;
      color(v, x);
    }
}
inline void dfs(int x, int p) {
  if (!rt[col[x]]) rt[col[x]] = x;
  vis[x] = 1;
  for (int v, i = h[x]; i; i = G[i].nt)
    if (!vis[v = G[i].v]) {
      if (col[v] != col[x]) {
        dfs(v, x);
        f1[x] = max(f1[x], f[v] + 1);
        if (f[v] > f[mx[x][0]]) {
          mx[x][1] = mx[x][0];
          mx[x][0] = v;
        } else if (f[v] > f[mx[x][1]])
          mx[x][1] = v;
      } else if (v != rt[col[x]])
        dfs(v, x);
    }
  if (x == rt[col[x]]) {
    int m = s[col[x]].size() - 1;
    for (int i = 1; i <= m; ++i)
      f2[x] = max(f2[x], f[s[col[x]][i]] + min(i, m - i + 1));
  }
  f[x] = max(f1[x], f2[x]);
}
inline void dgs(int x, int p) {
  vis[x] = 1;
  if (x == rt[col[x]]) {
    gmx(g[x], g[p] + 1);
    gmx(g[x], f2[p] + 1);
    if (mx[p][0] == x)
      gmx(g[x], f[mx[p][1]] + 2);
    else
      gmx(g[x], f1[p] + 1);
    int m = s[col[x]].size();
    for (int i = 1; i < m; ++i) gmx(g[s[col[x]][i]], g[x] + min(i, m - i));
    for (int i = 1; i <= m; ++i) w[i] = w[i + m] = s[col[x]][i - 1];
    int l = 1, r = 0, k = m >> 1;
    if (!k) goto next;
    for (int i = k; ~i; --i) {
      int j = m - i;
      while (l <= r && f1[w[q[r]]] - q[r] < f1[w[j]] - j) --r;
      q[++r] = j;
    }
    for (int i = m + 1; i <= m + m; ++i) {
      while (l <= r && q[l] < i - k) ++l;
      gmx(f2[w[i]], f1[w[q[l]]] + i - q[l]);
      while (l <= r && f1[w[q[r]]] - q[r] < f1[w[i]] - i) --r;
      q[++r] = i;
    }
    l = 1, r = 0;
    for (int i = m + k; i > m; --i) {
      while (l <= r && f1[w[q[r]]] + q[r] < f1[w[i]] + i) --r;
      q[++r] = i;
    }
    for (int i = m; i; --i) {
      while (l <= r && q[l] > i + k) ++l;
      gmx(f2[w[i]], f1[w[q[l]]] + q[l] - i);
      while (l <= r && f1[w[q[r]]] + q[r] < f1[w[i]] + i) --r;
      q[++r] = i;
    }
  }
next:
  for (int v, i = h[x]; i; i = G[i].nt)
    if (!vis[v = G[i].v]) dgs(v, x);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int x, y, i = 1; i <= m; ++i) {
    scanf("%d%d", &x, &y);
    adj(x, y);
  }
  tarjan(1, 0);
  Col = 1;
  color(1, 0);
  f1[0] = f2[0] = g[0] = *f = -1;
  dfs(1, 0);
  memset(vis, 0, sizeof vis);
  dgs(1, 0);
  for (int i = 1; i <= n; ++i) printf("%d ", max(max(f1[i], f2[i]), g[i]));
}