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;
inline long long read() {
  long long x = 0;
  bool f = 1;
  char s = getchar();
  while ((s < '0' || s > '9') && s > 0) {
    if (s == '-') f ^= 1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') x = (x << 1) + (x << 3) + s - '0', s = getchar();
  return f ? x : -x;
}
int n, m, ans[500005];
int IN, dfn[500005], low[500005], bl[500005], tot;
stack<int> st;
int d1[500005], sd[500005], d2[500005], ccg[500005];
vector<int> G[500005], cl[500005];
inline void dfs0(int x, int fa) {
  dfn[x] = low[x] = ++IN, st.push(x);
  for (unsigned i = 0; i < G[x].size(); i++) {
    int v = G[x][i];
    if (v == fa) continue;
    if (!dfn[v])
      dfs0(v, x), low[x] = min(low[x], low[v]);
    else
      low[x] = min(low[x], dfn[v]);
  }
  if (low[x] == dfn[x]) {
    tot++;
    while (!st.empty() && dfn[st.top()] >= dfn[x])
      bl[st.top()] = tot, cl[tot].push_back(st.top()), st.pop();
  }
}
queue<int> q;
int db[500005];
inline void bfs1(int x) {
  for (int i = 1; i <= n; i++) db[i] = -1;
  db[x] = 0, q.push(x);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (unsigned i = 0; i < G[u].size(); i++) {
      int v = G[u][i];
      if (db[v] < 0) db[v] = db[u] + 1, q.push(v);
    }
  }
}
inline void dfs1(int x) {
  d1[x] = 1;
  for (unsigned i = 0; i < G[x].size(); i++) {
    int v = G[x][i];
    if (db[v] == db[x] + 1) {
      if (!d1[v]) dfs1(v);
      d1[x] = max(d1[x], d1[v] + 1);
    }
  }
}
struct node {
  int x, y;
  node() {}
  node(int X, int Y) { x = X, y = Y; }
};
int dq[500005 << 1], hd, tl;
bool vis[500005];
inline void dfs2(int x) {
  vis[x] = 1;
  int len = cl[x].size(), cj = len >> 1;
  for (int id = 0; id < len; id++) {
    int u = cl[x][id];
    sd[u] = ans[u] = 1;
    for (unsigned i = 0; i < G[u].size(); i++) {
      int v = G[u][i];
      if (bl[u] != bl[v]) sd[u] = max(sd[u], d1[v] + 1);
    }
  }
  hd = tl = 0;
  for (int i = cj, lim = len << 1; i < lim; i++) {
    int u = cl[x][i % len], p;
    while (hd < tl && i - dq[hd] > cj) hd++;
    if (hd < tl) p = dq[hd], ans[u] = max(ans[u], i - p + sd[cl[x][p % len]]);
    while (hd < tl && ((p = dq[tl - 1]) || 1) &&
           i - p + sd[cl[x][p % len]] < sd[u])
      tl--;
    dq[tl++] = i;
  }
  hd = tl = 0;
  for (int i = cj, g = (len << 1) - 1; i <= g; i++) {
    int u = cl[x][(g - i) % len], p;
    while (hd < tl && i - dq[hd] > cj) hd++;
    if (hd < tl)
      p = dq[hd], ans[u] = max(ans[u], i - p + sd[cl[x][(g - p) % len]]);
    while (hd < tl && ((p = dq[tl - 1]) || 1) &&
           i - p + sd[cl[x][(g - p) % len]] < sd[u])
      tl--;
    dq[tl++] = i;
  }
  for (int id = 0; id < len; id++) {
    int u = cl[x][id];
    hd = tl = 0;
    for (unsigned i = 0; i < G[u].size(); i++)
      if (bl[G[u][i]] != x) {
        int v = G[u][i];
        while (hd < tl && d1[dq[tl - 1]] < d1[v]) tl--;
        dq[tl++] = v;
      }
    for (unsigned i = 0; i < G[u].size(); i++)
      if (bl[G[u][i]] != x) {
        int v = G[u][i], cg = ans[u];
        if (hd < tl && dq[hd] == v) hd++;
        if (hd < tl) cg = max(cg, d1[dq[hd]] + 1);
        while (hd < tl && d1[dq[tl - 1]] < d1[v]) tl--;
        dq[tl++] = v;
        if (!vis[bl[v]]) ccg[v] = cg;
      }
    for (unsigned i = 0; i < G[u].size(); i++)
      if (bl[G[u][i]] != x) {
        int v = G[u][i];
        if (!vis[bl[v]]) swap(d1[u], ccg[v]), dfs2(bl[v]), swap(d1[u], ccg[v]);
      }
  }
}
signed main() {
  n = read(), m = read();
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read();
    G[u].push_back(v), G[v].push_back(u);
  }
  dfs0(1, 0);
  bfs1(1), dfs1(1);
  dfs2(bl[1]);
  for (int i = 1; i <= n; i++) printf("%d ", max(ans[i], sd[i]) - 1);
  return 0;
}