#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> a;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    a.push_back(make_pair(x, y));
  }
  multiset<int> b[101];
  for (int i = 0; i < m; i++) {
    b[a[i].first].insert(a[i].second);
  }
  for (int i = 0; i < n; i++) {
    int total = 0;
    multiset<int> temp[101];
    for (int j = 0; j < n; j++) temp[j] = b[j];
    multiset<int> train;
    int z = 0;
    int pos = i;
    while (1) {
      while (train.count(pos)) {
        auto it = train.find(pos);
        z++;
        train.erase(it);
      }
      if (z == m) break;
      bool yes = 0;
      for (int k = pos - 1; k >= 0; k--) {
        if (temp[pos].count(k)) {
          train.insert(k);
          temp[pos].erase(temp[pos].find(k));
          yes = 1;
          break;
        }
      }
      if (yes == 0) {
        for (int k = n - 1; k > pos; k--) {
          if (temp[pos].count(k)) {
            train.insert(k);
            temp[pos].erase(temp[pos].find(k));
            break;
          }
        }
      }
      pos++;
      total++;
      pos %= n;
    }
    cout << total << ' ';
  }
  return 0;
}
