#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-9;
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
template <class T>
inline int chkmin(T& a, const T& val) {
  return val < a ? a = val, 1 : 0;
}
template <class T>
inline int chkmax(T& a, const T& val) {
  return a < val ? a = val, 1 : 0;
}
template <class T>
inline T isqrt(T k) {
  T r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
template <class T>
inline T icbrt(T k) {
  T r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
inline int sign(long double x) { return x < -EPS ? -1 : x > +EPS; }
inline int sign(long double x, long double y) { return sign(x - y); }
const int maxn = 1e5 + 5;
int n, m;
int a[maxn];
int b[maxn];
vector<int> adj[maxn];
int ix;
int compare(int x, int y) {
  if (x > ix && y < ix) return 0;
  if (x < ix && y > ix) return 1;
  return x > y;
}
struct RegionTree {
  static const int maxn = 1e5 + 5;
  int n, cnt;
  vector<int> adj[maxn];
  vector<int> tree[maxn];
  void init(int n) {
    this->n = n;
    for (int i = 0; i < n; i++) {
      adj[i].clear();
      tree[i].clear();
    }
  }
  void add(int u, int v) {
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  void build() {
    static map<pair<int, int>, int> hs;
    static vector<pair<int, int> > g[maxn];
    hs.clear();
    for (int i = 0; i < n; i++) {
      g[i].clear();
    }
    cnt = 0;
    for (int i = 0; i < n; i++) {
      int j = (i + 1) % n;
      adj[i].push_back(j);
      adj[j].push_back(i);
    }
    for (int i = 0; i < n; i++) {
      ix = i;
      sort(adj[i].begin(), adj[i].end(), compare);
    }
    for (int u = n - 1; u >= 0; u--) {
      for (int i = 1; i < (int)adj[u].size(); i++) {
        int v = adj[u][i];
        int w = adj[u][i - 1];
        if (!hs.count(make_pair(u, v))) {
          hs[make_pair(u, v)] = cnt;
          g[cnt].push_back(make_pair(u, v));
          cnt++;
        }
        int ix = hs[make_pair(u, v)];
        if (!hs.count(make_pair(w, u))) {
          g[ix].push_back(make_pair(w, u));
        }
        hs[make_pair(w, u)] = ix;
      }
    }
    for (int i = 0; i < cnt; i++) {
      for (int j = 0; j < (int)g[i].size(); j++) {
        pair<int, int> p = g[i][j];
        swap(p.first, p.second);
        if (hs.count(p)) {
          tree[i].push_back(hs[p]);
        }
      }
    }
  }
} rt;
int ans[maxn];
int dfs(int u, int p = -1) {
  int res = 0;
  int cnt[30] = {}, mx = 0;
  for (int i = (0); i < (int((adj[u]).size())); i++) {
    int v = adj[u][i];
    if (v != p) {
      int r = dfs(v, u);
      res |= r;
      for (int j = (0); j < (30); j++) {
        if ((((r) >> (j)) & 1)) {
          cnt[j]++;
        }
        if (cnt[j] > 1) chkmax(mx, j + 1);
      }
    }
  }
  for (int i = (mx); i < (30); i++)
    if (!(((res) >> (i)) & 1)) {
      for (int j = (0); j < (i); j++) res |= 1 << j, res ^= 1 << j;
      res |= 1 << i;
      ans[u] = i;
      break;
    }
  return res;
}
void solve() {
  cin >> n >> m;
  rt.init(n);
  for (int i = (0); i < (m); i++) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    rt.add(a[i], b[i]);
  }
  rt.build();
  int cnt = rt.cnt;
  for (int i = 0; i < cnt; i++) {
    adj[i] = rt.tree[i];
  }
  dfs(0);
  int mx = 0;
  for (int i = (0); i < (cnt); i++) chkmax(mx, ans[i]);
  for (int i = (0); i < (cnt); i++) {
    cout << mx - ans[cnt - i - 1] + 1 << " \n"[i == cnt - 1];
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
  return 0;
}
