#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<P> d(m); 
    rep(i, 0, m){
        cin >> d[i].first >> d[i].second;
        d[i].second--;
    }
    sort(all(d));
    vector<P> ans(n);
    rep(i, 0, n){
        ans[i] = {i, i};
    }
    rep(i, 0, m){
        int id = d[i].second;
        int l = min(ans[id].first, ans[id + 1].first);
        int r = max(ans[id].second, ans[id + 1].second);
        ans[id] = ans[id + 1] = {l, r};
    }
    for(int ii = 0; ii < ans.size(); ii++){
        if(ii) cout << ' ';
        cout << ans[ii].second - ans[ii].first + 1;
    }
    cout << endl;
}

### Prompt

Create a solution in cpp for the following problem:

Example

Input

4 3
1000 1
2000 2
3000 3


Output

2 3 4 4

### Response

```cpp
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<P> d(m); 
    rep(i, 0, m){
        cin >> d[i].first >> d[i].second;
        d[i].second--;
    }
    sort(all(d));
    vector<P> ans(n);
    rep(i, 0, n){
        ans[i] = {i, i};
    }
    rep(i, 0, m){
        int id = d[i].second;
        int l = min(ans[id].first, ans[id + 1].first);
        int r = max(ans[id].second, ans[id + 1].second);
        ans[id] = ans[id + 1] = {l, r};
    }
    for(int ii = 0; ii < ans.size(); ii++){
        if(ii) cout << ' ';
        cout << ans[ii].second - ans[ii].first + 1;
    }
    cout << endl;
}

```