#include <bits/stdc++.h>
using namespace std;
multiset<int> Set;
pair<int, int> c[181], d[181];
int a, b, n, m, i, j, k, nom, ans;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (i = 1; i <= n; i++) c[i].first = 2000000000;
  for (i = 1; i <= m; i++) {
    cin >> a >> b;
    c[a].second++;
    if (a < b)
      c[a].first = min(c[a].first, b - a);
    else
      c[a].first = min(c[a].first, n - (a - b));
  }
  for (i = 1; i <= n; i++) d[i] = c[i];
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) c[j] = d[j];
    nom = i;
    ans = 0;
    k = m;
    Set.clear();
    while (true) {
      if (Set.find(nom) != Set.end()) Set.erase(nom);
      if (k == 0 && Set.empty()) break;
      if (c[nom].second == 0) {
        ans++;
        nom++;
        if (nom > n) nom -= n;
        continue;
      }
      if (c[nom].second == 1) {
        if (nom + c[nom].first <= n)
          Set.insert(nom + c[nom].first);
        else
          Set.insert(nom + c[nom].first - n);
      }
      c[nom].second--;
      k--;
      ans++;
      nom++;
      if (nom > n) nom -= n;
    }
    cout << ans << " ";
  }
  cout << '\n';
  return 0;
}
