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;
void Read(int &p) {
  p = 0;
  char c = getchar();
  for (; c < '0' || c > '9'; c = getchar())
    ;
  for (; c >= '0' && c <= '9'; c = getchar()) p = p * 10 + c - '0';
}
struct Node {
  int cnt, tar[2000005], nex[2000005], fir[500005];
  Node() { cnt = 1; }
  void Add(int a, int b) {
    cnt++;
    tar[cnt] = b;
    nex[cnt] = fir[a];
    fir[a] = cnt;
  }
} g, h;
int n, m;
int dfn[500005], low[500005], idx[500005], tim, tot;
int vis[500005], use[2000005], stk[500005], top;
int dep[500005], dep1[500005], dep0[500005], lmx[500005], rmx[500005];
int dis[500005], val[500005 << 2], lvl[500005 << 2], rvl[500005 << 2];
vector<int> cir[500005], son[500005], V[500005];
void Tarjan(int x) {
  dfn[x] = low[x] = ++tim;
  vis[x] = 1;
  stk[++top] = x;
  for (int i = g.fir[x]; i; i = g.nex[i]) {
    if (use[i / 2]) continue;
    use[i / 2] = 1;
    int v = g.tar[i];
    if (!vis[v]) {
      Tarjan(v);
      low[x] = min(low[x], low[v]);
    } else if (!idx[v])
      low[x] = min(low[x], low[v]);
  }
  if (dfn[x] == low[x]) {
    tot++;
    do {
      idx[stk[top]] = tot;
    } while (stk[top--] != x);
  }
}
void Getloop(int x) {
  if (vis[x]) return;
  vis[x] = 1;
  cir[idx[x]].push_back(x);
  for (int i = g.fir[x]; i; i = g.nex[i]) {
    int v = g.tar[i];
    if (idx[v] == idx[x]) Getloop(v);
  }
}
void Build(int x, int f) {
  int w = idx[x];
  cir[w].clear();
  Getloop(x);
  for (int i = 0; i < (int)cir[w].size(); i++) {
    int u = cir[w][i];
    son[u].clear();
    for (int j = g.fir[u]; j; j = g.nex[j]) {
      int v = g.tar[j];
      if (idx[v] == w || idx[v] == f) continue;
      son[u].push_back(v);
      Build(v, w);
    }
  }
}
void Getdepth(int x) {
  int w = idx[x];
  for (int i = 0; i < (int)cir[w].size(); i++) {
    int u = cir[w][i];
    dep[u] = 0;
    for (int j = 0; j < (int)son[u].size(); j++) {
      int v = son[u][j];
      Getdepth(v);
      dep[u] = max(dep[u], dep[v] + 1);
    }
  }
  int n = cir[w].size() - 1;
  lmx[0] = rmx[n + 1] = 0;
  for (int i = 1; i <= n; i++) lmx[i] = max(lmx[i - 1], dep[cir[w][i]] + i);
  for (int i = n; i >= 1; i--)
    rmx[i] = max(rmx[i + 1], dep[cir[w][i]] + (n - i + 1));
  w = 0x3f3f3f3f;
  for (int i = 1; i <= n + 1; i++) w = min(w, max(lmx[i - 1], rmx[i]));
  dep0[x] = dep[x], dep1[x] = w;
  dep[x] = max(dep0[x], dep1[x]);
}
struct Queue {
  int hd, tl, q[500005 << 2], d[500005 << 2];
  void Init() { hd = 1, tl = 0; }
  int Fro() { return hd <= tl ? q[hd] : -0x3f3f3f3f; }
  int Nex(int w) {
    if (hd > tl) return -0x3f3f3f3f;
    if (d[hd] != w) return q[hd];
    return hd == tl ? -0x3f3f3f3f : q[hd + 1];
  }
  void Push(int v, int w) {
    while (hd <= tl && q[tl] <= v) tl--;
    tl++;
    q[tl] = v, d[tl] = w;
  }
  void Pop(int w) {
    while (hd <= tl && d[hd] < w) hd++;
  }
} Q1, Q2;
void Solve(int x, int d) {
  int w = idx[x];
  dis[x] = d;
  int n = cir[w].size();
  for (int i = 1; i < n; i++) val[i] = dep[cir[w][i]];
  val[0] = max(dep0[x], dis[x]);
  for (int i = n; i < n * 3; i++) val[i] = val[i % n];
  for (int i = 0; i < n * 3; i++) {
    lvl[i] = val[i] + n * 3 - i;
    rvl[i] = val[i] + i + 1;
  }
  Q1.Init(), Q2.Init();
  int lp = 2, rp = n + 1;
  for (int i = lp; i <= n; i++) Q1.Push(lvl[i], i);
  for (int i = n + 1; i < n * 2; i++) {
    int res = 0x3f3f3f3f;
    int v1 = n * 3 - i, v2 = i + 1;
    while (rp < i) {
      Q1.Pop(++lp);
      rp++;
      if (rp != i) Q2.Push(rvl[rp], rp);
    }
    while (Q1.Nex(lp) - v1 > max(Q2.Fro(), rvl[rp + 1]) - v2) {
      res = min(res, Q1.Fro() - v1);
      Q1.Pop(++lp);
      rp++, Q2.Push(rvl[rp], rp);
    }
    res = min(res, Q1.Fro() - v1);
    res = min(res, max(Q2.Fro(), rvl[rp + 1]) - v2);
    Q1.Push(lvl[i], i);
    Q2.Pop(i + 2);
    dis[cir[w][i % n]] = res;
  }
  for (int i = 0; i < n; i++) {
    int u = cir[w][i];
    int m = son[u].size();
    lmx[0] = rmx[m + 1] = 0;
    for (int j = 1; j <= m; j++)
      lmx[j] = max(lmx[j - 1], dep[son[u][j - 1]] + 1);
    for (int j = m; j >= 1; j--)
      rmx[j] = max(rmx[j + 1], dep[son[u][j - 1]] + 1);
    V[u].clear();
    for (int j = 0; j < m; j++) V[u].push_back(max(lmx[j], rmx[j + 2]));
    for (int j = 0; j < m; j++)
      Solve(son[u][j], max(dep1[u], max(dis[u], V[u][j])) + 1);
  }
}
int main() {
  Read(n), Read(m);
  for (int i = 1; i <= m; i++) {
    int a, b;
    Read(a), Read(b);
    g.Add(a, b), g.Add(b, a);
  }
  for (int i = 1; i <= n; i++)
    if (!vis[i]) Tarjan(i);
  memset(vis, 0, sizeof vis);
  Build(1, 0);
  Getdepth(1);
  Solve(1, 0);
  for (int i = 1; i <= n; i++)
    printf("%d%c", max(dis[i], dep[i]), i == n ? 10 : 32);
}