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 comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int maxn = 1e6 + 10;
template <class T>
T mymin(const T a, const T b) {
  return a < b ? a : b;
}
template <class T>
T mymax(const T a, const T b) {
  return a > b ? a : b;
}
int dfn[maxn], low[maxn], scc_cnt, dfs_clock, inst[maxn], bel[maxn];
struct edge {
  int u, v;
  edge(int a = 0, int b = 0) : u(a), v(b){};
};
vector<edge> es;
vector<int> G[maxn], sccs[maxn];
stack<int> S;
int N, M;
bool isbridge[maxn << 2];
void tarjan(int u, int in_edge) {
  dfn[u] = low[u] = ++dfs_clock;
  S.push(u);
  for (int nx : G[u]) {
    int v = es[nx].v;
    if (!dfn[v]) {
      tarjan(v, nx);
      low[u] = min(low[u], low[v]);
      if (low[v] > dfn[u]) isbridge[nx] = 1;
    } else if (nx != (in_edge ^ 1))
      low[u] = min(low[u], dfn[v]);
  }
  if (low[u] == dfn[u]) {
    int v;
    scc_cnt++;
    do {
      v = S.top();
      S.pop();
      sccs[scc_cnt].emplace_back(v);
      bel[v] = scc_cnt;
    } while (!S.empty() && u != v);
  }
}
int L[maxn], fa[maxn], dep[maxn], Z[maxn];
bool vis[maxn];
void bfs() {
  queue<int> q;
  q.push(1);
  vector<int> nodes;
  vis[1] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    nodes.emplace_back(u);
    for (int nx : G[u]) {
      int v = es[nx].v;
      if (!vis[v]) {
        vis[v] = 1;
        q.push(v);
        fa[v] = u;
      }
    }
  }
  for (auto it = nodes.rbegin(); it != nodes.rend(); it++) {
    int u = *it;
    for (int nx : G[u]) {
      int v = es[nx].v;
      if (fa[v] == u) {
        dep[u] = max(dep[v] + 1, dep[u]);
        if (isbridge[nx]) {
          L[u] = max(L[u], 1 + dep[v]);
        }
      }
    }
  }
}
void solve(int u, int par, int upval) {
  L[u] = max(L[u], upval);
  auto &cycle = sccs[bel[u]];
  for (int it = 0; it < 2; it++) {
    priority_queue<pair<int, int> > q;
    for (int i = 0; i < 2 * cycle.size(); i++) {
      int d = 2 * cycle.size() - i;
      while (!q.empty() && q.top().second - d > cycle.size() / 2) q.pop();
      if (!q.empty())
        Z[cycle[i % cycle.size()]] =
            max(Z[cycle[i % cycle.size()]], q.top().first - d);
      q.push(make_pair(L[cycle[i % cycle.size()]] + d, d));
    }
    reverse(cycle.begin(), cycle.end());
  }
  for (auto u : cycle) {
    int mx1, mx2;
    mx1 = mx2 = 0;
    for (int nx : G[u]) {
      int v = es[nx].v;
      if (v == par || !isbridge[nx]) continue;
      if (mx2 < 1 + dep[v]) {
        mx2 = 1 + dep[v];
        if (mx1 < mx2) swap(mx1, mx2);
      }
    }
    for (int nx : G[u]) {
      int v = es[nx].v;
      if (v == par || !isbridge[nx]) continue;
      int pssval = max(upval, Z[u]);
      if (mx1 == 1 + dep[v])
        pssval = max(pssval, mx2);
      else
        pssval = max(pssval, mx1);
      solve(v, u, pssval + 1);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> M;
  for (int i = 1; i <= M; i++) {
    int u, v;
    cin >> u >> v;
    es.emplace_back(edge(u, v));
    es.emplace_back(edge(v, u));
    G[u].emplace_back(es.size() - 2);
    G[v].emplace_back(es.size() - 1);
  }
  for (int i = 1; i <= N; i++)
    if (!dfn[i]) tarjan(i, 0);
  bfs();
  solve(1, 0, 0);
  for (int i = 1; i <= N; i++) cout << max(L[i], Z[i]) << " ";
  cout << endl;
  return 0;
}