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>
#pragma GCC optimize("Ofast")
using namespace std;
template <class _>
void chkmin(_ &a, _ b) {
  if (a > b) a = b;
}
template <class _>
void chkmax(_ &a, _ b) {
  if (a < b) a = b;
}
int n, m;
int tid;
int tim;
int dfn_cnt;
int dfn[500005];
int low[500005];
int col[500005];
int Cir[500005];
int St[500005];
int Ed[500005];
int Stk[500005];
int top;
struct node {
  int to, id;
};
vector<node> G[500005];
void Tarjan(int x, int id) {
  dfn[x] = low[x] = ++dfn_cnt;
  Stk[++top] = x;
  for (int i = 0; i < (int)G[x].size(); i++) {
    node y = G[x][i];
    if (y.id == id) continue;
    if (!dfn[y.to]) {
      Tarjan(y.to, y.id);
      chkmin(low[x], low[y.to]);
    } else
      chkmin(low[x], dfn[y.to]);
  }
  if (low[x] == dfn[x]) {
    int y = 0;
    tid++;
    St[x] = tim + 1;
    col[x] = tid;
    do {
      y = Stk[top--];
      col[y] = tid;
      Cir[++tim] = y;
    } while (y != x);
    Ed[x] = tim;
    for (int i = (St[x]), i_end_ = (Ed[x]); i <= i_end_; i++) {
      if (i > (St[x] + Ed[x]) / 2) break;
      swap(Cir[i], Cir[Ed[x] - (i - St[x])]);
    }
  }
}
int Q[500005];
int L, R;
int vis[500005];
int dis[500005];
int dp[500005];
int Fa[500005];
int Mark[500005];
int Max[500005][2];
int pos[500005][2];
void Update(int x, int y) {
  if (Max[x][0] <= dis[y] + 1) {
    Max[x][1] = Max[x][0];
    pos[x][1] = pos[x][0];
    Max[x][0] = dis[y] + 1;
    pos[x][0] = y;
  } else if (Max[x][1] < dis[y] + 1) {
    Max[x][1] = dis[y] + 1;
    pos[x][1] = y;
  }
}
void bfs() {
  L = 1, R = 0;
  Q[++R] = 1;
  vis[1] = 1;
  while (L <= R) {
    int a = Q[L++];
    for (int i = 0; i < (int)G[a].size(); i++) {
      int y = G[a][i].to;
      if (vis[y]) continue;
      vis[y] = 1;
      Fa[y] = a;
      Q[++R] = y;
    }
  }
  for (int i = (n), i_end_ = (1); i >= i_end_; i--) {
    int y = Q[i];
    int x = Fa[y];
    if (x == 0) continue;
    chkmax(dis[x], dis[y] + 1);
    if (col[x] == col[y]) continue;
    Update(x, y);
  }
}
struct Node {
  int id, val;
} S[500005];
int len;
int Len(int a, int b) {
  if (a >= b)
    return a - b + 1;
  else
    return len + 1 - (b - a);
}
void dfs(int x, int f, int d) {
  len = Ed[x] - St[x] + 1;
  Mark[x] = 1;
  for (int i = (St[x]), i_end_ = (Ed[x]); i <= i_end_; i++) Mark[Cir[i]] = 1;
  dp[x] = d;
  if (len != 1) {
    int t = len / 2 + 1;
    L = 1, R = 0;
    for (int i = (t), i_end_ = (1); i >= i_end_; i--) {
      int id = Cir[i + St[x] - 1];
      int val = Max[id][0];
      if (i == 1) chkmax(val, d);
      if (i == 1) chkmax(dp[x], S[L].val + Len(S[L].id, 1) - 1);
      while (L <= R && S[R].val + Len(S[R].id, 1) <= val + Len(i, 1)) R--;
      S[++R] = (Node){i, val};
    }
    for (int i = (len), i_end_ = (1); i >= i_end_; i--) {
      int id = Cir[i + St[x] - 1];
      int val = Max[id][0];
      while (L <= R && Len(S[L].id, i) > t) L++;
      chkmax(dp[id], S[L].val + Len(S[L].id, i) - 1);
      while (L <= R && S[R].val + Len(S[R].id, i) - 1 <= val) R--;
      S[++R] = (Node){i, val};
    }
    for (int i = (St[x] + 1), i_end_ = (Ed[x]); i <= i_end_; i++) {
      if (i > (St[x] + Ed[x]) / 2) break;
      swap(Cir[i], Cir[Ed[x] + St[x] + 1 - i]);
    }
    L = 1, R = 0;
    for (int i = (t), i_end_ = (1); i >= i_end_; i--) {
      int id = Cir[i + St[x] - 1];
      int val = Max[id][0];
      if (i == 1) chkmax(val, d);
      if (i == 1) chkmax(dp[x], S[L].val + Len(S[L].id, 1) - 1);
      while (L <= R && S[R].val + Len(S[R].id, 1) <= val + Len(i, 1)) R--;
      S[++R] = (Node){i, val};
    }
    for (int i = (len), i_end_ = (1); i >= i_end_; i--) {
      int id = Cir[i + St[x] - 1];
      int val = Max[id][0];
      while (L <= R && Len(S[L].id, i) > t) L++;
      chkmax(dp[id], S[L].val + Len(S[L].id, i) - 1);
      while (L <= R && S[R].val + Len(S[R].id, i) - 1 <= val) R--;
      S[++R] = (Node){i, val};
    }
  }
  for (int i = (St[x]), i_end_ = (Ed[x]); i <= i_end_; i++) {
    int a = Cir[i];
    for (int j = 0; j < (int)G[a].size(); j++) {
      int y = G[a][j].to;
      if (col[a] == col[y]) continue;
      int v = dp[a] + 1;
      if (Mark[y]) continue;
      if (y == pos[a][0])
        chkmax(v, Max[a][1] + 1);
      else
        chkmax(v, Max[a][0] + 1);
      dfs(y, a, v);
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (1), i_end_ = (m); i <= i_end_; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    G[a].push_back((node){b, i});
    G[b].push_back((node){a, i});
  }
  Tarjan(1, 0);
  bfs();
  dfs(1, 0, 0);
  for (int i = (1), i_end_ = (n); i <= i_end_; i++) {
    printf("%d\n", max(dp[i], Max[i][0]));
  }
  return 0;
}