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;
template <typename T>
inline void chkmin(T &a, T b) {
  a = a < b ? a : b;
}
template <typename T>
inline void chkmax(T &a, T b) {
  a = a > b ? a : b;
}
const int MAXN = 500005, MAXM = 1500005;
template <const int N, const int M, typename T = int>
struct Graph {
  T to[M], bb[M];
  int aa[M], cnt[N], tot, n;
  void clear() {
    memset(cnt, 0, sizeof(cnt));
    tot = n = 0;
  }
  Graph() { clear(); }
  struct Point {
    T *beg, *ed;
    T *begin() { return beg; }
    T *end() { return ed; }
  } po[N];
  Point &operator[](int x) { return po[x]; }
  void addedge(int u, T v) { ++cnt[u], ++tot, aa[tot] = u, bb[tot] = v; }
  void init(int nn = 0) {
    n = nn;
    po[1].beg = po[1].ed = to;
    for (int i = 2; i <= n; i++)
      po[i].ed = po[i].beg = po[i - 1].beg + cnt[i - 1];
    for (int i = 1; i <= tot; i++) *(po[aa[i]].ed++) = bb[i];
  }
};
Graph<MAXN, MAXM> cac, tr;
int que[MAXM], out[MAXN], id[MAXN], n, m, tp, dcnt, bcnt;
int adj[MAXN], dfn[MAXN], sta[MAXN], low[MAXN], bel[MAXN];
vector<int> cir[MAXN];
void tarjan(int u, int fa) {
  dfn[u] = low[u] = ++dcnt, sta[++tp] = u;
  for (int v : cac[u]) {
    if (v == fa) continue;
    if (!dfn[v]) {
      tarjan(v, u);
      chkmin(low[u], low[v]);
    } else
      chkmin(low[u], dfn[v]);
  }
  if (dfn[u] == low[u]) {
    ++bcnt;
    while (sta[tp + 1] != u) {
      int v = sta[tp--];
      cir[bcnt].push_back(v);
      bel[v] = bcnt;
    }
    reverse(cir[bcnt].begin(), cir[bcnt].end());
    for (int i = 0; i < (int)cir[bcnt].size(); i++) id[cir[bcnt][i]] = i;
  }
}
int f[MAXN], g[MAXN], g1[MAXN], val[MAXM], ans[MAXN];
void dfs1(int u) {
  int s = cir[u].size();
  f[u] = s >> 1;
  for (int v : tr[u]) {
    dfs1(v);
    int q = adj[v], p = id[q];
    if (g[q] <= f[v])
      g1[q] = g[q], g[q] = f[v] + 1;
    else if (g1[q] <= f[v])
      g1[q] = f[v] + 1;
    chkmax(f[u], f[v] + 1 + min(p, s - p));
  }
}
void dfs2(int u) {
  int m = cir[u].size(), a = m >> 1, b = m - a - 1;
  for (int i = 0; i < m; i++) {
    val[i] = g[cir[u][i]] - i;
    val[i + m] = val[i] - m;
    ans[i] = 0;
  }
  int he = 1, ta = 0;
  for (int i = 0; i < m << 1; i++) {
    if (i >= a && he <= ta) chkmax(ans[i % m], val[que[he]] + i);
    while (he <= ta && val[que[ta]] <= val[i]) --ta;
    que[++ta] = i;
    if (que[he] == i - a) ++he;
  }
  for (int i = 0; i < m; i++) {
    val[i] = g[cir[u][i]] + i;
    val[i + m] = val[i] + m;
  }
  he = 1, ta = 0;
  for (int i = (m << 1) - 1; i >= 0; i--) {
    if (i < (m << 1) - b && he <= ta) chkmax(ans[i % m], val[que[he]] - i);
    while (he <= ta && val[que[ta]] <= val[i]) --ta;
    que[++ta] = i;
    if (que[he] == i + b) ++he;
  }
  for (int i = 0; i < m; i++) {
    int v = cir[u][i];
    out[v] = max(g[v], ans[i]);
    if (g[v] < ans[i])
      g1[v] = g[v], g[v] = ans[i];
    else if (g1[v] < ans[i])
      g1[v] = ans[i];
  }
  for (int v : tr[u]) {
    int p = adj[v], q = (f[v] + 1 == g[p] ? g1[p] : g[p]) + 1;
    if (g[p = cir[v][0]] < q)
      g1[p] = g[p], g[p] = q;
    else if (g1[p] < q)
      g1[p] = q;
    dfs2(v);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    cac.addedge(u, v);
    cac.addedge(v, u);
  }
  cac.init(n);
  tarjan(1, 0);
  for (int i = 1; i <= n; i++)
    for (int j : cac[i])
      if (bel[j] < bel[i]) {
        tr.addedge(bel[i], bel[j]);
        adj[bel[j]] = i;
      }
  tr.init(bcnt);
  dfs1(bcnt);
  dfs2(bcnt);
  assert(out[1] == f[bcnt]);
  for (int i = 1; i <= n; i++) printf("%d ", out[i]);
  return 0;
}