#include<bits/stdc++.h>
using namespace std;
int n,m;
struct jxb{
	int x,y;
};
bool cmp(jxb b,jxb c){
	return b.x<c.x;
}
jxb a[100010];
int ans[200010];
map<int,int>mp;
map<int,int>f;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d%d",&a[i].x,&a[i].y);
	}
	sort(a+1,a+m+1,cmp);
	for(int i=1;i<=n;i++) ans[i]=1;
	for(int i=1;i<=m;i++){
		if(mp[a[i].y]==1){
			ans[a[i].y]=ans[a[i].y+1]=ans[a[i].y]+ans[a[i].y+1]-f[a[i].y];
			f[a[i].y]=ans[a[i].y];
		}else{
			mp[a[i].y]=1;
			ans[a[i].y]+=ans[a[i].y+1];
			ans[a[i].y+1]=ans[a[i].y];
			f[a[i].y]=ans[a[i].y];
		}
	}
	for(int i=1;i<=n;i++){
		printf("%d",ans[i]);
		if(i!=n) printf(" ");
	}
	printf("\n");
	return 0;
}
### Prompt

Please provide a CPP coded solution to the problem described below:

Example

Input

4 3
1000 1
2000 2
3000 3


Output

2 3 4 4

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
int n,m;
struct jxb{
	int x,y;
};
bool cmp(jxb b,jxb c){
	return b.x<c.x;
}
jxb a[100010];
int ans[200010];
map<int,int>mp;
map<int,int>f;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d%d",&a[i].x,&a[i].y);
	}
	sort(a+1,a+m+1,cmp);
	for(int i=1;i<=n;i++) ans[i]=1;
	for(int i=1;i<=m;i++){
		if(mp[a[i].y]==1){
			ans[a[i].y]=ans[a[i].y+1]=ans[a[i].y]+ans[a[i].y+1]-f[a[i].y];
			f[a[i].y]=ans[a[i].y];
		}else{
			mp[a[i].y]=1;
			ans[a[i].y]+=ans[a[i].y+1];
			ans[a[i].y+1]=ans[a[i].y];
			f[a[i].y]=ans[a[i].y];
		}
	}
	for(int i=1;i<=n;i++){
		printf("%d",ans[i]);
		if(i!=n) printf(" ");
	}
	printf("\n");
	return 0;
}
```