#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
int n, m, tot, head[maxn], f[maxn], g[maxn], h[maxn], a[maxn], fa[maxn],
    dep[maxn], ea[maxn], eb[maxn], fr[maxn];
struct node {
  int nxt, to;
} edge[maxn << 1];
bool vis[maxn], b[maxn];
int read() {
  int x = 0;
  char c = getchar();
  while (c < 48 || c > 57) c = getchar();
  while (c >= 48 && c <= 57) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  return x;
}
void add(int u, int v) {
  edge[++tot] = (node){head[u], v};
  head[u] = tot;
}
void wrk(int cnt) {
  int i, mn = m + 1, mx = 0;
  for (i = 1; i <= cnt; i++) mx = max(mx, a[i]), mn = min(mn, a[i]);
  for (i = 2; i <= cnt - 1; i++)
    if (a[i] != mx && a[i] != mn && !((a[i] < a[i - 1]) ^ (a[i] < a[i + 1])))
      return;
  if (a[1] != mx && a[1] != mn && !((a[1] < a[2]) ^ (a[1] < a[cnt]))) return;
  if (a[cnt] != mx && a[cnt] != mn &&
      !((a[cnt] < a[cnt - 1]) ^ (a[cnt] < a[1])))
    return;
  h[mn] = mx;
}
void dfs(int u, int f) {
  vis[u] = b[u] = 1;
  fa[u] = f;
  int i, v, j;
  for (i = head[u]; i; i = edge[i].nxt) {
    v = edge[i].to;
    if (v == f) continue;
    if (!b[v]) {
      fr[v] = (i >> 1);
      dfs(v, u);
    } else if (vis[v]) {
      int cnt = 0;
      a[++cnt] = (i >> 1);
      j = u;
      while (j != v) {
        a[++cnt] = fr[j];
        j = fa[j];
      }
      wrk(cnt);
    }
  }
  vis[u] = 0;
}
int fnd(int x) {
  if (fa[x] ^ x) fa[x] = fnd(fa[x]);
  return fa[x];
}
int main() {
  tot = 1;
  int i, u, v, ta, tb;
  n = read(), m = read();
  for (i = 1; i <= m; i++) {
    ea[i] = read(), eb[i] = read();
    add(ea[i], eb[i]);
    add(eb[i], ea[i]);
  }
  dfs(1, 0);
  for (i = 1; i <= n; i++) fa[i] = i, dep[i] = f[i] = 1;
  for (i = m; i >= 1; i--) {
    u = ea[i], v = eb[i];
    ta = fnd(u), tb = fnd(v);
    if (ta != tb) {
      if (dep[ta] < dep[tb])
        fa[ta] = tb, dep[tb] = max(dep[tb], dep[ta] + 1);
      else
        fa[tb] = ta, dep[ta] = max(dep[ta], dep[tb] + 1);
      g[i] = f[u] = f[v] = f[u] + f[v];
    } else
      g[i] = f[u] = f[v] = f[u] + f[v] - g[h[i]];
  }
  for (i = 1; i <= n; i++) printf("%d ", f[i] - 1);
  puts("");
  return 0;
}
