#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 2;
int n, m, a, b, mx, l[N], res[N], mn[N], cnt[N], ad[N];
long long ans = 0;
int main() {
  cin >> n >> m;
  memset(mn, '?', sizeof mn);
  while (m--) {
    scanf("%d%d", &a, &b);
    a--, b--;
    ++cnt[a];
    if (b > a) {
      if (mn[a] > b - a) mn[a] = b - a, res[a] = b;
    } else if (mn[a] > n - a + b)
      mn[a] = n - a + b, res[a] = b;
    mx = max(mx, cnt[a]);
  }
  if (mx > 1)
    for (int i = 0; i < n; i++) {
      if (cnt[i] == mx - 1) {
        for (int j = 0; j < n; j++) {
          if (res[i] < j) {
            if (ad[j] < n - j + res[i] && mn[i] > n - j + res[i])
              ad[j] = n - j + res[i];
          } else if (ad[j] < res[i] - j && mn[i] > res[i] - j)
            ad[j] = res[i] - j;
        }
      }
    }
  ans = (mx - 1) * n;
  int cur, d = 0, add;
  for (int i = 0; i < n; i++) {
    int j = i;
    add = 0;
    for (int k = 0; k < 2 * n; k++) {
      cur = (j + k) % n;
      if (d) add = k;
      if (l[cur]) {
        --d;
        l[cur] = 0;
      }
      if (k < n) {
        if (cnt[cur] == mx) {
          if (!l[res[cur]]) ++d;
          l[res[cur]]++;
        }
      }
    }
    printf("%d ", ans + max(add, ad[i]));
  }
}
