//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

PII p[200020];
PII ans[200010];
signed main(void)
{
  int n, m;
  cin >> n >> m;
  REP(i, m) cin >> p[i].first >> p[i].second;
  sort(p, p+m);
  REP(i, n) ans[i] = {i, i};
  REP(i, m) {
    int y=p[i].second;
    chmin(ans[y].first, ans[y-1].first);
    chmax(ans[y-1].second, ans[y].second);
  }
  REP(i, n) {
    cout << ans[i].second-ans[i].first+1;
    if(i != n-1) cout << " ";
  }
  cout << endl;

  return 0;
}
### Prompt

Develop a solution in CPP to the problem described below:

Example

Input

4 3
1000 1
2000 2
3000 3


Output

2 3 4 4

### Response

```cpp
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#ifdef int
const ll INF = (1LL<<60);
#else
const int INF = (1LL<<30);
#endif
const double PI = 3.14159265359;
const double EPS = 1e-12;
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

PII p[200020];
PII ans[200010];
signed main(void)
{
  int n, m;
  cin >> n >> m;
  REP(i, m) cin >> p[i].first >> p[i].second;
  sort(p, p+m);
  REP(i, n) ans[i] = {i, i};
  REP(i, m) {
    int y=p[i].second;
    chmin(ans[y].first, ans[y-1].first);
    chmax(ans[y-1].second, ans[y].second);
  }
  REP(i, n) {
    cout << ans[i].second-ans[i].first+1;
    if(i != n-1) cout << " ";
  }
  cout << endl;

  return 0;
}
```