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>
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
  if (flag) x = -x;
}
using namespace std;
inline void MAX(int &a, int b) {
  if (a < b) a = b;
}
int n, m;
struct edge {
  int nxt, to;
  edge() {}
  edge(int jzp, int zzz) { nxt = jzp, to = zzz; }
} e[1001000 << 1];
int head[1001000], ecnt = 1;
inline void addedge(int from, int to) {
  e[++ecnt] = edge(head[from], to);
  head[from] = ecnt;
}
int dep[1001000], fa[1001000];
bool evis[1001000 << 1];
void dfs_tree(int cur, int faa) {
  fa[cur] = faa;
  dep[cur] = dep[faa] + 1;
  for (int i = head[cur]; i; i = e[i].nxt) {
    int to = e[i].to;
    if (to == faa) continue;
    if (dep[to]) {
      evis[i >> 1] = true;
      continue;
    }
    dfs_tree(to, cur);
  }
}
int col[1001000], ctot;
vector<int> vec[1001000];
int mxd[1001000];
int mx[1001000], smx[1001000];
inline void calc_cir(int cur) {
  static int h[1001000];
  static pair<int, int> que[1001000];
  int front = 0, rear = 0, htot = 0;
  for (unsigned int i = 0; i < vec[cur].size(); ++i) h[++htot] = vec[cur][i];
  for (int i = 1; i <= htot; ++i) {
    int p = h[i];
    mx[p] = smx[p] = mxd[p] = 0;
    for (int j = head[p]; j; j = e[j].nxt) {
      int to = e[j].to;
      if (col[to] == cur) continue;
      int v = max(mxd[to], mx[to]) + 1;
      if (v >= mx[p])
        smx[p] = mx[p], mx[p] = v;
      else if (v > smx[p])
        smx[p] = v;
    }
  }
  for (int i = htot - (htot >> 1) + 1; i <= htot; ++i) {
    pair<int, int> v = make_pair(mx[h[i]] + (htot - i), -(htot - i));
    while (front < rear && v > que[rear]) --rear;
    que[++rear] = v;
  }
  for (int i = 1; i <= htot; ++i) {
    int p = h[i];
    if (front < rear && i - que[front + 1].second > (htot >> 1)) ++front;
    if (front < rear) MAX(mxd[p], que[front + 1].first + i);
    pair<int, int> v = make_pair(mx[p] - i, i);
    while (front < rear && v > que[rear]) --rear;
    que[++rear] = v;
  }
  front = rear = 0;
  reverse(h + 1, h + 1 + htot);
  for (int i = htot - (htot >> 1) + 1; i <= htot; ++i) {
    pair<int, int> v = make_pair(mx[h[i]] + (htot - i), -(htot - i));
    while (front < rear && v > que[rear]) --rear;
    que[++rear] = v;
  }
  for (int i = 1; i <= htot; ++i) {
    int p = h[i];
    if (front < rear && i - que[front + 1].second > (htot >> 1)) ++front;
    if (front < rear) MAX(mxd[p], que[front + 1].first + i);
    pair<int, int> v = make_pair(mx[p] - i, i);
    while (front < rear && v > que[rear]) --rear;
    que[++rear] = v;
  }
}
void dfs_init(int cur, int faa) {
  for (unsigned int i = 0; i < vec[cur].size(); ++i) {
    int p = vec[cur][i];
    mx[p] = mxd[p] = -1;
    for (int j = head[p]; j; j = e[j].nxt) {
      int to = e[j].to;
      if (to == faa || col[to] == cur) continue;
      dfs_init(col[to], p);
    }
  }
  calc_cir(cur);
}
int ans[1001000];
void dfs_cg(int cur, int faa) {
  calc_cir(cur);
  for (unsigned int i = 0; i < vec[cur].size(); ++i) {
    int p = vec[cur][i];
    ans[p] = max(mx[p], mxd[p]);
  }
  for (unsigned int i = 0; i < vec[cur].size(); ++i) {
    int p = vec[cur][i];
    for (int j = head[p]; j; j = e[j].nxt) {
      int to = e[j].to;
      if (to == faa || col[to] == cur) continue;
      int bkup = mx[p];
      mx[p] = (max(mx[to], mxd[to]) + 1) == mx[p] ? smx[p] : mx[p];
      dfs_cg(col[to], p);
      mx[p] = bkup;
    }
  }
}
int main() {
  read(n), read(m);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    read(u), read(v);
    addedge(u, v), addedge(v, u);
  }
  dfs_tree(1, 0);
  for (int i = 1; i <= m; ++i)
    if (evis[i]) {
      int x = e[i << 1].to, y = e[i << 1 | 1].to;
      ++ctot;
      static int stk[1001000];
      int stop = 0;
      while (x != y) {
        if (dep[x] > dep[y])
          vec[ctot].push_back(x), col[x] = ctot, x = fa[x];
        else
          stk[++stop] = y, col[y] = ctot, y = fa[y];
      }
      col[x] = ctot;
      stk[++stop] = x;
      while (stop) vec[ctot].push_back(stk[stop--]);
    }
  for (int i = 1; i <= n; ++i)
    if (!col[i]) col[i] = ++ctot, vec[ctot].push_back(i);
  dfs_init(1, 0);
  dfs_cg(1, 0);
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  puts("");
  return 0;
}