#include <bits/stdc++.h>
#define MAXN 200005
#define MAXM 100005
#define from first
#define to second
using namespace std;
struct arm
{
    int x,y;
    bool operator< (const arm &b) const
    {
        return x<b.x;
    }
}arms[MAXM];
int n,m;
pair<int,int> ans[MAXN];

int main()
{
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;++i)
        scanf("%d%d",&(arms[i].x),&(arms[i].y));
    for(int i=1;i<=n;++i)
        ans[i].from=ans[i].to=i;
    sort(arms,arms+m);
    for(int i=0;i<m;++i)
    {
        int y=arms[i].y;
        ans[y].from=ans[y+1].from=min(ans[y].from,ans[y+1].from);
        ans[y].to=ans[y+1].to=max(ans[y].to,ans[y+1].to);
    }
    for(int i=1;i<=n;++i)
    {
        if(i>1)
            printf(" ");
        printf("%d",ans[i].to-ans[i].from+1);
    }
    printf("\n");
}
### 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>
#define MAXN 200005
#define MAXM 100005
#define from first
#define to second
using namespace std;
struct arm
{
    int x,y;
    bool operator< (const arm &b) const
    {
        return x<b.x;
    }
}arms[MAXM];
int n,m;
pair<int,int> ans[MAXN];

int main()
{
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;++i)
        scanf("%d%d",&(arms[i].x),&(arms[i].y));
    for(int i=1;i<=n;++i)
        ans[i].from=ans[i].to=i;
    sort(arms,arms+m);
    for(int i=0;i<m;++i)
    {
        int y=arms[i].y;
        ans[y].from=ans[y+1].from=min(ans[y].from,ans[y+1].from);
        ans[y].to=ans[y+1].to=max(ans[y].to,ans[y+1].to);
    }
    for(int i=1;i<=n;++i)
    {
        if(i>1)
            printf(" ");
        printf("%d",ans[i].to-ans[i].from+1);
    }
    printf("\n");
}
```