#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int l[200010], r[200010];

int main(){
  int n, m;
  cin >> n >> m;

  vector<pii> v;
  REP(i,m){
    int x, y;
    cin >> x >> y;
    v.pb(MP(x, y));
  }

  SORTV(v);

  REP(i,n){
    l[i] = i;
    r[i] = i;
  }

  REP(i,m){
    int l_min, r_max;
    int lane = v[i].second;
    l_min = min(l[lane-1], l[lane]);
    r_max = max(r[lane-1], r[lane]);
    l[lane-1] = l_min; l[lane] = l_min;
    r[lane-1] = r_max, r[lane] = r_max;
  }

  REP(i,n){
    cout << r[i] - l[i] + 1;
    if(i != n-1){
      cout << " ";
    }
  }
  cout << "\n";

  return 0;
}


### Prompt

Construct a CPP code solution to the problem outlined:

Example

Input

4 3
1000 1
2000 2
3000 3


Output

2 3 4 4

### Response

```cpp
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int l[200010], r[200010];

int main(){
  int n, m;
  cin >> n >> m;

  vector<pii> v;
  REP(i,m){
    int x, y;
    cin >> x >> y;
    v.pb(MP(x, y));
  }

  SORTV(v);

  REP(i,n){
    l[i] = i;
    r[i] = i;
  }

  REP(i,m){
    int l_min, r_max;
    int lane = v[i].second;
    l_min = min(l[lane-1], l[lane]);
    r_max = max(r[lane-1], r[lane]);
    l[lane-1] = l_min; l[lane] = l_min;
    r[lane-1] = r_max, r[lane] = r_max;
  }

  REP(i,n){
    cout << r[i] - l[i] + 1;
    if(i != n-1){
      cout << " ";
    }
  }
  cout << "\n";

  return 0;
}


```