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>
#pragma GCC optimize("Ofast")
using namespace std;
namespace IO {
char ss[1 << 18], *A = ss, *B = ss;
inline char gc() {
  return A == B && (B = (A = ss) + fread(ss, 1, 1 << 18, stdin), A == B) ? -1
                                                                         : *A++;
}
template <class T>
inline void Rd(T &x) {
  char c;
  while (c = gc(), (c < 48 || 57 < c) && c != -1)
    ;
  x = (c ^ 48);
  while (c = gc(), 47 < c && c < 58) x = (x << 3) + (x << 1) + (c ^ 48);
}
char sr[1 << 21], z[20];
int C = -1, Z;
inline void Ot() { fwrite(sr, 1, C + 1, stdout), C = -1; }
template <class T>
inline void Wt(T x) {
  if (C > 1 << 20) Ot();
  while (z[++Z] = x % 10 ^ 48, x /= 10)
    ;
  while (sr[++C] = z[Z], --Z)
    ;
  sr[++C] = '\n';
}
}  // namespace IO
template <class T>
inline bool chkmin(T &a, T const &b) {
  return a > b ? a = b, true : false;
}
template <class T>
inline bool chkmax(T &a, T const &b) {
  return a < b ? a = b, true : false;
}
const int M = 500005;
struct Queue {
  int pos[M << 1], val[M << 1];
  int head, tail;
  void clear() { head = tail = 0; }
  void push(int r, int x) {
    while (head < tail and val[tail - 1] < x) --tail;
    pos[tail] = r;
    val[tail] = x;
    ++tail;
  }
  int maxn(int l) {
    if (head < tail and pos[head] < l) ++head;
    return head < tail ? val[head] : 0;
  }
} Q0, Q1;
struct edge {
  int to;
  edge *next;
} * E[M], *G[M << 1], Pool[M * 6], *allc = Pool;
int dfn[M], low[M], Fa[M], dep[M];
int Q[M], A[M][2], B[M], val[M * 3], id[M];
int n, m, top, l, r, dfn_cnt, scc_cnt;
void add_edge(int u, int v, edge **G) {
  *allc = (edge){v, G[u]};
  G[u] = allc++;
}
void solve_ring(int u, int v) {
  int w = ++scc_cnt;
  int len = dep[v] - dep[u] + 1;
  for (int x = v, d = 1; x != u; x = Fa[x], ++d) {
    add_edge(w, x, G);
    chkmax(B[w - n], A[x][0] + min(d, len - d));
  }
  int tmp = B[w - n];
  for (int k = (0), k_end__ = (2); k < k_end__; ++k)
    if (tmp > A[u][k]) swap(tmp, A[u][k]);
  add_edge(u, w, G);
}
void Tarjan(int u, int fa) {
  low[u] = dfn[u] = ++dfn_cnt;
  for (edge *e = u[E]; e; e = e->next) {
    int v = e->to;
    if (v == fa) continue;
    if (!v[dfn]) {
      dep[v] = dep[u] + 1;
      Tarjan(v, Fa[v] = u);
      chkmin(low[u], low[v]);
    } else
      chkmin(low[u], dfn[v]);
  }
  for (edge *e = u[E]; e; e = e->next) {
    if ((Fa[e->to] != u and low[e->to] == dfn[u]) or low[e->to] > dfn[u])
      solve_ring(u, e->to);
  }
}
void solve(int u, int w) {
  int sz = 0;
  Q0.clear(), Q1.clear();
  val[sz] = A[u][B[w - n] == A[u][0]];
  id[sz++] = u;
  for (edge *e = G[w]; e; e = e->next) {
    Q[r++] = id[sz] = e->to;
    val[sz] = A[e->to][0];
    ++sz;
  }
  for (int i = (0), i_end__ = (sz); i < i_end__; ++i)
    val[i + sz + sz] = val[i + sz] = val[i];
  int len0 = sz >> 1, pos0 = sz + 1;
  int len1 = sz - len0 - 1, pos1 = sz + len1 + 2;
  for (int i = (pos0 - len0), i_end__ = (pos0); i < i_end__; ++i)
    Q0.push(i, val[i] - i);
  for (int i = (pos1 - len1), i_end__ = (pos1); i < i_end__; ++i)
    Q1.push(i, val[i] + i);
  for (int i = (1), i_end__ = (sz); i < i_end__; ++i) {
    int u = id[i];
    int x = Q0.maxn(pos0 - len0) + i + sz;
    int y = Q1.maxn(pos1 - len1) - i - sz;
    for (int k = (0), k_end__ = (2); k < k_end__; ++k)
      if (x > A[u][k]) swap(x, A[u][k]);
    for (int k = (0), k_end__ = (2); k < k_end__; ++k)
      if (y > A[u][k]) swap(y, A[u][k]);
    Q0.push(pos0, val[pos0] - pos0), ++pos0;
    Q1.push(pos1, val[pos1] + pos1), ++pos1;
  }
}
int main() {
  IO::Rd(n), IO::Rd(m);
  while (m--) {
    int u, v;
    IO::Rd(u), IO::Rd(v);
    add_edge(u, v, E);
    add_edge(v, u, E);
  }
  scc_cnt = n;
  Tarjan(1, -1);
  Q[r++] = 1;
  while (l < r) {
    int u = Q[l++];
    for (edge *e = G[u]; e; e = e->next) {
      solve(u, e->to);
    }
  }
  for (int i = (1), i_end__ = (n + 1); i < i_end__; ++i) IO::Wt(A[i][0]);
  return IO::Ot(), 0;
}