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 void read(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = v * 10 + c - '0';
  while (isdigit(c = getchar())) v = v * 10 + c - '0';
  x = v * f;
}
inline void read(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = v * 10 + c - '0';
  while (isdigit(c = getchar())) v = v * 10 + c - '0';
  x = v * f;
}
inline void readc(char &x) {
  char c;
  while ((c = getchar()) == ' ')
    ;
  x = c;
}
inline void writes(string s) { puts(s.c_str()); }
inline void writeln() { writes(""); }
inline void writei(int x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
inline void writell(long long x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
long long n, m, i, j, f[500005], g[500005], f0[500005], f1[500005],
    rk[500005][2], ti, csc, cid[500005], vis[500005], p[500005], a[1000005],
    qx[1000005], ql, qr;
vector<long long> e[500005], seq[500005];
stack<long long> stk;
void dfs(long long x, long long fa) {
  p[x] = fa;
  vis[x] = 1;
  for (__typeof((e[x]).begin()) it = (e[x]).begin(); it != (e[x]).end(); it++) {
    if (*it == fa) continue;
    if (vis[*it]) {
      if (!cid[*it]) {
        csc++;
        seq[csc].push_back(*it);
        cid[*it] = csc;
        int i;
        for (i = x; i != *it; i = p[i]) {
          seq[csc].push_back(i);
          cid[i] = csc;
        }
      }
    } else {
      dfs(*it, x);
    }
  }
  if (!cid[x]) {
    csc++;
    cid[x] = csc;
    seq[csc].push_back(x);
  }
}
void gtf(int x) {
  vis[x] = 1;
  for (__typeof((e[x]).begin()) it = (e[x]).begin(); it != (e[x]).end(); it++) {
    if (vis[*it]) continue;
    gtf(*it);
    if (cid[*it] != cid[x]) {
      f0[x] = max(f0[x], f[*it] + 1);
      if (!f[rk[x][1]] || f[rk[x][1]] < f[*it]) rk[x][1] = *it;
      if (!f[rk[x][0]] || f[rk[x][0]] < f[rk[x][1]]) swap(rk[x][0], rk[x][1]);
    }
  }
  if (seq[cid[x]][0] == x) {
    int i;
    if ((1) <= ((seq[cid[x]].size() - 1)))
      for (((i)) = (1); ((i)) <= ((seq[cid[x]].size() - 1)); ((i))++) {
        f1[x] = max(f1[x],
                    f[seq[cid[x]][i]] + min(i, (int)(seq[cid[x]].size() - i)));
      }
  }
  f[x] = max(f0[x], f1[x]);
}
void gtg(int x) {
  vis[x] = 1;
  if (x != 1 && cid[x] != cid[p[x]]) {
    g[x] = max(g[x], g[p[x]] + 1);
    g[x] = max(g[x], f1[p[x]] + 1);
    if (rk[p[x]][0] == x) {
      if (rk[p[x]][1]) g[x] = max(g[x], f[rk[p[x]][1]] + 2);
    } else if (rk[p[x]][0])
      g[x] = max(g[x], f[rk[p[x]][0]] + 2);
  }
  f0[x] = max(f0[x], g[x]);
  if (seq[cid[x]][0] == x) {
    int i, m = seq[cid[x]].size();
    for (i = 0; i < seq[cid[x]].size(); i++) {
      a[i + 1] = f0[seq[cid[x]][i]];
    }
    if ((1) <= ((m)))
      for (((i)) = (1); ((i)) <= ((m)); ((i))++) a[i + m] = a[i];
    ql = qr = 1;
    qx[1] = 0;
    for (i = 2; i <= m + m; i++) {
      while (ql <= qr && qx[ql] + m / 2 < i) ql++;
      if (ql <= qr)
        g[seq[cid[x]][(i - 1) % m]] =
            max(g[seq[cid[x]][(i - 1) % m]], a[qx[ql]] + i - qx[ql]);
      while (ql <= qr && a[qx[qr]] - qx[qr] < a[i] - i) qr--;
      qx[++qr] = i;
    }
    ql = qr = 1;
    qx[1] = m + m;
    for (i = m + m - 1; i >= 1; i--) {
      while (ql <= qr && qx[ql] - m / 2 > i) ql++;
      if (ql <= qr)
        g[seq[cid[x]][(i - 1) % m]] =
            max(g[seq[cid[x]][(i - 1) % m]], a[qx[ql]] - i + qx[ql]);
      while (ql <= qr && a[qx[qr]] + qx[qr] < a[i] + i) qr--;
      qx[++qr] = i;
    }
  }
  for (__typeof((e[x]).begin()) it = (e[x]).begin(); it != (e[x]).end(); it++) {
    if (vis[*it]) continue;
    gtg(*it);
  }
}
int main() {
  read(n);
  read(m);
  if ((1) <= ((m)))
    for (((i)) = (1); ((i)) <= ((m)); ((i))++) {
      long long x, y;
      read(x);
      read(y);
      e[x].push_back(y);
      e[y].push_back(x);
    }
  dfs(1, 0);
  memset(vis, 0, sizeof(vis));
  gtf(1);
  memset(vis, 0, sizeof(vis));
  gtg(1);
  if ((1) <= ((n)))
    for (((i)) = (1); ((i)) <= ((n)); ((i))++) printf("%d ", max(f[i], g[i]));
  return 0;
}