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;
const int MAXN = 5e5 + 11;
int n, m;
vector<vector<pair<int, int> > > g;
bool is_bridge[MAXN * 2];
vector<vector<int> > cycles;
int cycle_idx[MAXN];
bool vis[MAXN];
int parent[MAXN], maxlen[MAXN], L[MAXN], Z[MAXN];
struct mb {
  int low[MAXN], idx[MAXN], dfs;
  void mark_bridges(int u, int f) {
    low[u] = idx[u] = ++dfs;
    for (long long(i) = (0); (i) < (g[u].size()); (i)++) {
      int v = g[u][i].first;
      if (idx[v] == 0) {
        mark_bridges(v, u);
        low[u] = min(low[u], low[v]);
        if (low[v] > idx[u]) is_bridge[g[u][i].second] = 1;
      } else if (v != f)
        low[u] = min(low[u], idx[v]);
    }
  }
} G;
void find_cycles(int u) {
  vis[u] = 1;
  cycles.back().push_back(u);
  cycle_idx[u] = cycles.size() - 1;
  for (__typeof((g[u]).begin()) iter = (g[u]).begin(); iter != (g[u]).end();
       iter++)
    if (!is_bridge[iter->second] && !vis[iter->first]) find_cycles(iter->first);
}
void find_spanningtree_and_init(int starting_node) {
  queue<int> Q;
  vector<int> node_by_depth;
  Q.push(starting_node);
  memset(vis, 0, sizeof(vis));
  vis[starting_node] = 1;
  parent[starting_node] = -1;
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    node_by_depth.push_back(u);
    for (__typeof((g[u]).begin()) iter = (g[u]).begin(); iter != (g[u]).end();
         iter++) {
      int v = iter->first;
      if (vis[v]) continue;
      vis[v] = 1;
      parent[v] = u;
      Q.push(v);
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    int u = node_by_depth[i];
    for (__typeof((g[u]).begin()) iter = (g[u]).begin(); iter != (g[u]).end();
         iter++) {
      int v = iter->first;
      if (parent[v] == u) {
        maxlen[u] = max(maxlen[u], 1 + maxlen[v]);
        if (is_bridge[iter->second]) L[u] = max(L[u], 1 + maxlen[v]);
      }
    }
  }
}
void solve_cycle(int u, int f, int upvalue) {
  L[u] = max(L[u], upvalue);
  vector<int> &cycle = cycles[cycle_idx[u]];
  int k = cycle.size();
  for (long long(it) = (0); (it) < (2); (it)++) {
    priority_queue<pair<int, int> > Q;
    for (long long(i) = (0); (i) < (2 * k); (i)++) {
      int d = 2 * k - i;
      while (!Q.empty() && Q.top().second - d > k / 2) Q.pop();
      if (!Q.empty()) Z[cycle[i % k]] = max(Z[cycle[i % k]], Q.top().first - d);
      Q.push(make_pair(L[cycle[i % k]] + d, d));
    }
    reverse(cycle.begin(), cycle.end());
  }
  for (auto u : cycle) {
    int firstMax = 0, secondMax = 0;
    for (auto e : g[u])
      if (e.first != f && is_bridge[e.second]) {
        int v = e.first;
        if (secondMax < 1 + maxlen[v]) {
          secondMax = 1 + maxlen[v];
          if (firstMax < secondMax) swap(firstMax, secondMax);
        }
      }
    for (auto e : g[u])
      if (e.first != f && is_bridge[e.second]) {
        int v = e.first;
        int passValue = max(upvalue, Z[u]);
        if (firstMax == 1 + maxlen[v])
          passValue = max(passValue, secondMax);
        else
          passValue = max(passValue, firstMax);
        solve_cycle(v, u, passValue + 1);
      }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  g.resize(n);
  for (long long(i) = (0); (i) < (m); (i)++) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--;
    v--;
    g[u].push_back(make_pair(v, i));
    g[v].push_back(make_pair(u, i));
  }
  G.mark_bridges(0, -1);
  for (long long(i) = (0); (i) < (n); (i)++)
    if (!vis[i]) {
      cycles.push_back(vector<int>());
      find_cycles(i);
    }
  find_spanningtree_and_init(0);
  solve_cycle(0, -1, 0);
  for (long long(i) = (0); (i) < (n); (i)++) {
    if (i > 0) printf(" ");
    printf("%d", max(L[i], Z[i]));
  }
  printf("\n");
  return 0;
}