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 N = 5e5 + 5;
vector<int> edges[N];
vector<pair<int, pair<int, int>>> edges_scc[N];
vector<int> cnt_scc1[N];
vector<int> cnt_scc2[N];
vector<int> cnt_cyc[N];
stack<int> st;
int dfn[N];
int low[N];
int scc_len[N];
pair<int, int> scc[N];
int scc_cnt = 0;
int T = 1;
int tarjan(int s, int p) {
  st.push(s);
  dfn[s] = T;
  low[s] = T++;
  for (int next : edges[s]) {
    if (next == p)
      ;
    else if (dfn[next])
      low[s] = min(low[s], dfn[next]);
    else
      low[s] = min(low[s], tarjan(next, s));
  }
  if (low[s] == dfn[s]) {
    scc_cnt++;
    int idx = 0;
    while (!st.empty()) {
      int top = st.top();
      st.pop();
      scc[top] = {scc_cnt, ++idx};
      if (top == s) break;
    }
    scc_len[scc_cnt] = idx;
  }
  return low[s];
}
void add_edges_of_scc(int n) {
  for (int i = 1; i <= n; i += 1) {
    for (int next : edges[i]) {
      if (scc[i].first != scc[next].first) {
        edges_scc[scc[i].first].push_back(
            {scc[next].first, {scc[i].second, scc[next].second}});
      }
    }
  }
}
int dfs_scc(int ss, int sid, int sp) {
  cnt_scc1[ss].assign(scc_len[ss] + 1, 0);
  cnt_scc2[ss].assign(scc_len[ss] + 1, 0);
  cnt_cyc[ss].assign(scc_len[ss] + 1, 0);
  for (auto &np : edges_scc[ss]) {
    int ns = np.first;
    int cn = np.second.first;
    int nn = np.second.second;
    if (ns != sp) {
      int tmp = 1 + dfs_scc(ns, nn, ss);
      if (tmp > cnt_scc2[ss][cn]) {
        cnt_scc2[ss][cn] = tmp;
        if (cnt_scc2[ss][cn] > cnt_scc1[ss][cn])
          swap(cnt_scc1[ss][cn], cnt_scc2[ss][cn]);
      }
    }
  }
  int res = 0;
  int ls = scc_len[ss];
  for (int i = 1; i < ls / 2 + 1; i += 1) {
    int id = sid + i;
    if (id > ls) id -= ls;
    res = max(res, i + cnt_scc1[ss][id]);
  }
  for (int i = 1; i < ls / 2 + 1; i += 1) {
    int id = sid - i;
    if (id < 1) id += ls;
    res = max(res, i + cnt_scc1[ss][id]);
  }
  cnt_cyc[ss][sid] = res;
  return max(cnt_scc1[ss][sid], cnt_cyc[ss][sid]);
}
void cal(int ss, int sid, int sp, int pl) {
  if (pl + 1 > cnt_scc2[ss][sid]) {
    cnt_scc2[ss][sid] = pl + 1;
    if (cnt_scc2[ss][sid] > cnt_scc1[ss][sid])
      swap(cnt_scc1[ss][sid], cnt_scc2[ss][sid]);
  }
  int ls = scc_len[ss];
  for (int flag = 1; flag >= -1; flag -= 2) {
    priority_queue<pair<int, int>> pq;
    int idx = 0;
    for (idx = 0; idx < ls / 2 + 1; idx += 1) {
      int id = sid + idx * flag;
      if (id > ls)
        id -= ls;
      else if (id < 1)
        id += ls;
      pq.push({cnt_scc1[ss][id] + idx, idx});
    }
    int jdx = 0;
    while (jdx < ls) {
      int id = sid + jdx * flag;
      if (id > ls)
        id -= ls;
      else if (id < 1)
        id += ls;
      while (!pq.empty()) {
        if (pq.top().second <= jdx)
          pq.pop();
        else {
          cnt_cyc[ss][id] = max(cnt_cyc[ss][id], pq.top().first - jdx);
          break;
        }
      }
      int nid = sid + idx * flag;
      while (nid > ls) nid -= ls;
      while (nid < 1) nid += ls;
      pq.push({cnt_scc1[ss][nid] + idx, idx});
      idx += 1;
      jdx += 1;
    }
  }
  for (auto &np : edges_scc[ss]) {
    int ns = np.first;
    int cn = np.second.first;
    int nn = np.second.second;
    if (ns == sp) continue;
    if (cnt_scc1[ss][cn] == max(cnt_scc1[ns][nn], cnt_cyc[ns][nn]) + 1)
      cal(ns, nn, ss, max(cnt_scc2[ss][cn], cnt_cyc[ss][cn]));
    else
      cal(ns, nn, ss, max(cnt_scc1[ss][cn], cnt_cyc[ss][cn]));
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i += 1) {
    int u, v;
    cin >> u >> v;
    edges[u].push_back(v);
    edges[v].push_back(u);
  }
  tarjan(1, 0);
  add_edges_of_scc(n);
  dfs_scc(scc[1].first, scc[1].second, 0);
  cal(scc[1].first, scc[1].second, 0, -1);
  for (int i = 1; i <= n; i += 1) {
    int ss = scc[i].first;
    int sid = scc[i].second;
    cout << max(cnt_scc1[ss][sid], cnt_cyc[ss][sid]) << " ";
  }
  cout << endl;
}