#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
int MOD = 998244353;
int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> ans(2 * n + 10);
  vector<pint> D(k);
  for (int i = 0; i < (int)(k); i++) {
    int l, r;
    cin >> l >> r;
    D[i] = make_pair(l, r);
    ans[l] += 1;
    ans[r + 1] -= 1;
  }
  ll temp = 0;
  for (int i = 1; i < n; i++) {
    temp = (ans[i] + temp) % MOD;
    cout << temp << endl;
    if (temp <= 0) continue;
    for (int j = 0; j < k; j++) {
      int l = D[j].first;
      int r = D[j].second;
      ans[i + l] = (ans[i + l] + temp);
      ans[i + r + 1] = (ans[i + r + 1] - temp);
    }
  }
  for (int i = 1; i < n; i++) {
    ans[i] = (ans[i] + ans[i - 1]) % MOD;
  }
  cout << ans[n - 1] << endl;
}
