#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 50;
int n, m;
vector<int> G[N];
int dfn[N], tim, frm[N];
vector<int> cir[N];
int ct = 0;
map<pair<int, int>, int> id;
int dc[N], dp[N], rm[N];
pair<int, int> e[N];
void dfs(int u, int f) {
  dfn[u] = ++tim;
  for (int v : G[u])
    if (v != f) {
      if (!dfn[v])
        frm[v] = u, dfs(v, u);
      else if (dfn[v] < dfn[u]) {
        ++ct;
        cir[ct].push_back(v);
        for (int x = u; x != v; x = frm[x]) cir[ct].push_back(x);
      }
    }
}
void work(vector<int> &z) {
  int n = z.size();
  z.push_back(z[0]);
  static int c[N];
  for (int i = 0; i < n; i++) c[i] = id[pair<int, int>(z[i], z[i + 1])];
  int mx = 0, mn = 0;
  for (int i = 0; i < n; i++)
    if (c[i] > c[mx]) mx = i;
  for (int i = 0; i < n; i++)
    if (c[i] < c[mn]) mn = i;
  int x = (mn + 1) % n, lp = c[mn];
  while (x != mx) {
    if (c[x] < lp) return;
    lp = c[x];
    x = (x + 1) % n;
  }
  x = mn, lp = c[mn];
  while (x != mx + 1) {
    lp = c[x];
    x = (x + n - 1) % n;
    if (c[x] < lp) return;
  }
  dc[c[mn]] = c[mx];
}
int main() {
  cin >> n >> m;
  for (int i = 1, u, v; i <= m; i++)
    scanf("%d%d", &u, &v), G[u].push_back(v), G[v].push_back(u),
        id[pair<int, int>(u, v)] = id[pair<int, int>(v, u)] = i,
                             e[i] = pair<int, int>(u, v);
  dfs(1, 0);
  for (int i = 1; i <= ct; i++) work(cir[i]);
  for (int i = 1; i <= n; i++) dp[i] = 1;
  for (int i = m, u, v; i >= 1; i--) {
    u = e[i].first, v = e[i].second;
    rm[i] = dp[u] = dp[v] = dp[u] + dp[v] - rm[dc[i]];
  }
  for (int i = 1; i <= n; i++) cout << dp[i] - 1 << '\n';
  return 0;
}
