#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const int MAXN = 205;
int n, m, candy[MAXN], u, v;
vector<pair<int, int> > g[150];
bool myfunc(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    u--;
    v--;
    if (u > v) {
      g[u].push_back({n - u + v, v});
    } else {
      g[u].push_back({v - u, v});
    }
  }
  for (int i = 0; i < n; i++) sort(g[i].begin(), g[i].end(), myfunc);
  for (int k = 0; k < n; k++) {
    int mm = m;
    int i = k, t = 0;
    memset(candy, 0, sizeof candy);
    vector<pair<int, int> > gg[150];
    for (int i = 0; i < n; i++) {
      gg[i] = g[i];
    }
    while (mm > 0) {
      if (gg[i].size() > 0) {
        candy[gg[i].back().second]++;
        gg[i].pop_back();
      }
      if (candy[i] > 0) {
        mm -= candy[i];
        candy[i] = 0;
      }
      i = (i + 1) % n;
      t++;
    }
    cout << t - 1 << " ";
  }
}
