
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a*b/gcd(a,b);
}


int main(void) {
    int i,j;
    int n,m;
    cin >> n >> m;
    vector<pii> p(m);
    rep(i,m)cin >> p[i].first >> p[i].second;
    sort(all(p));
    vector<vi> ans(n,vi(2));
    rep(i,n)ans[i][0] = ans[i][1] = i;//閉区間
    rep(i,m){
        int arm = p[i].second-1;
        int x = min(ans[arm][0],ans[arm+1][0]);
        int y = max(ans[arm][1],ans[arm+1][1]);
        ans[arm][0] = ans[arm+1][0] = x;
        ans[arm][1] = ans[arm+1][1] = y;
    }
    rep(i,n){
        cout << ans[i][1] - ans[i][0]+1;
        if(i<n-1)cout << " ";
        else cout << endl;
    }


}


### Prompt

Please formulate a Cpp solution to the following problem:

Example

Input

4 3
1000 1
2000 2
3000 3


Output

2 3 4 4

### Response

```cpp

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a*b/gcd(a,b);
}


int main(void) {
    int i,j;
    int n,m;
    cin >> n >> m;
    vector<pii> p(m);
    rep(i,m)cin >> p[i].first >> p[i].second;
    sort(all(p));
    vector<vi> ans(n,vi(2));
    rep(i,n)ans[i][0] = ans[i][1] = i;//閉区間
    rep(i,m){
        int arm = p[i].second-1;
        int x = min(ans[arm][0],ans[arm+1][0]);
        int y = max(ans[arm][1],ans[arm+1][1]);
        ans[arm][0] = ans[arm+1][0] = x;
        ans[arm][1] = ans[arm+1][1] = y;
    }
    rep(i,n){
        cout << ans[i][1] - ans[i][0]+1;
        if(i<n-1)cout << " ";
        else cout << endl;
    }


}


```