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 std ::reverse;
using std ::vector;
template <typename T>
T max(T x, T y) {
  return (x > y) ? x : y;
}
template <typename T>
T min(T x, T y) {
  return (x < y) ? x : y;
}
template <typename T>
bool chkmax(T &x, T y) {
  return (x >= y) ? 0 : (x = y, 1);
}
template <typename T>
bool chkmin(T &x, T y) {
  return (x <= y) ? 0 : (x = y, 1);
}
template <typename T>
T read(T &in) {
  in = 0;
  char ch;
  T f = 1;
  while (!isdigit(ch = getchar()))
    if (ch == '-') f = -1;
  while (isdigit(ch)) in = in * 10 + ch - '0', ch = getchar();
  return in *= f;
}
static const int max1 = 500000 + 11;
static const int max2 = 2000000 + 11;
int Ct = 1, Ht[max1], Nt[max2], to[max2];
void ins(int x, int y) {
  Nt[++Ct] = Ht[x], Ht[x] = Ct, to[Ct] = y;
  Nt[++Ct] = Ht[y], Ht[y] = Ct, to[Ct] = x;
}
int n, m;
int dt, dfn[max1], low[max1];
bool isB[max2], vis[max1];
int stack[max1], *top = stack;
int cnt, atC[max1];
int mL[max1], L[max1], Z[max1];
vector<int> C[max1];
void Tarjan(int x, int fa) {
  int y;
  dfn[x] = low[x] = ++dt, *(++top) = x;
  for (int i = (Ht[x]); i; i = (Nt[i]))
    if (to[i] != fa) {
      y = to[i];
      if (!dfn[y]) {
        Tarjan(y, x), chkmin(low[x], low[y]);
        if (low[y] > low[x]) isB[i] = isB[i ^ 1] = 1;
      } else
        chkmin(low[x], dfn[y]);
    }
  if (dfn[x] != low[x]) return;
  ++cnt;
  do {
    y = *(top--);
    atC[y] = cnt;
    C[cnt].push_back(y);
  } while (x != y);
}
void GetBfsTree() {
  static int que[max1], fa[max1];
  int *front = que, *back = que;
  *(++back) = 1, vis[1] = 1;
  while (front < back) {
    int x = *(++front);
    for (int i = (Ht[x]); i; i = (Nt[i]))
      if (!vis[to[i]]) vis[to[i]] = 1, fa[to[i]] = x, *(++back) = to[i];
  }
  for (int _q = (n), _qr = (1); _q >= (_qr); --_q) {
    int x = que[_q];
    for (int i = (Ht[x]); i; i = (Nt[i]))
      if (fa[to[i]] == x) {
        chkmax(mL[x], mL[to[i]] + 1);
        if (isB[i]) chkmax(L[x], mL[to[i]] + 1);
      }
  }
}
void solve(int now, int fa, int upd) {
  static int q[max2], que[max2];
  int *front = que + 1, *back = que;
  chkmax(L[now], upd);
  int qt = (int)C[atC[now]].size();
  for (int i = (1), ir = (qt); i <= (ir); ++i)
    q[i] = q[i + qt] = C[atC[now]][i - 1];
  for (int twice = (0), twicer = (1); twice <= (twicer); ++twice) {
    front = que + 1, back = que;
    for (int i = ((qt >> 1) + qt), ir = (1 + qt); i >= (ir); --i) {
      while (front <= back && L[q[i]] + i > L[q[*back]] + *back) --back;
      *(++back) = i;
    }
    for (int i = (qt), ir = (1); i >= (ir); --i) {
      while (front <= back && *front - i > (qt >> 1)) ++front;
      if (front <= back) chkmax(Z[q[i]], L[q[*front]] + *front - i);
      while (front <= back && L[q[i]] + i > L[q[*back]] + *back) --back;
      *(++back) = i;
    }
    reverse(1 + q, 1 + (qt << 1) + q);
  }
  vector<int>::iterator x;
  for (x = C[atC[now]].begin(); x != C[atC[now]].end(); ++x) {
    int fMax = 0, sMax = 0;
    for (int i = (Ht[*x]); i; i = (Nt[i]))
      if (to[i] != fa && isB[i]) {
        if (chkmax(sMax, mL[to[i]] + 1)) {
          if (sMax > fMax) std ::swap(sMax, fMax);
        }
      }
    for (int i = (Ht[*x]); i; i = (Nt[i]))
      if (to[i] != fa && isB[i]) {
        int n_upd = max(Z[*x], upd);
        if (mL[to[i]] + 1 == fMax)
          chkmax(n_upd, sMax);
        else
          chkmax(n_upd, fMax);
        solve(to[i], *x, n_upd + 1);
      }
  }
}
int main() {
  read(n), read(m);
  for (int i = (1), ir = (m); i <= (ir); ++i) {
    int x, y;
    read(x), read(y);
    ins(x, y);
  }
  Tarjan(1, 0);
  GetBfsTree();
  solve(1, 0, 0);
  for (int i = (1), ir = (n); i <= (ir); ++i) printf("%d ", max(L[i], Z[i]));
  putchar(10);
  return 0;
}