#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int main(){
	int n, m;
	cin >> n >> m;
	vector<P> a(m);
	REP(i,m) cin >> a[i].first >> a[i].second;
	sort(a.begin(), a.end());
	VI l(n), r(n);
	REP(i,n) l[i] = r[i] = i;
	REP(i,m){
		int y = a[i].second - 1;
		l[y] = min(l[y], l[y+1]);
		l[y+1] = l[y];
		r[y] = max(r[y], r[y+1]);
		r[y+1] = r[y];
	}
	REP(i,n){
		cout << r[i] - l[i] + 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
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi acos(-1.0)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int main(){
	int n, m;
	cin >> n >> m;
	vector<P> a(m);
	REP(i,m) cin >> a[i].first >> a[i].second;
	sort(a.begin(), a.end());
	VI l(n), r(n);
	REP(i,n) l[i] = r[i] = i;
	REP(i,m){
		int y = a[i].second - 1;
		l[y] = min(l[y], l[y+1]);
		l[y+1] = l[y];
		r[y] = max(r[y], r[y+1]);
		r[y+1] = r[y];
	}
	REP(i,n){
		cout << r[i] - l[i] + 1;
		if (i < n-1) cout << " ";
	}
	cout << endl;
    return 0;
}
```