#include <bits/stdc++.h>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, M; cin >> N >> M;
  vector<PII> xs(M);
  REP(i,M){
	cin >> xs[i];
  }
  SORT(xs);

  VI l(N+1), r(N+1);
  REP(i,N+1) l[i] = r[i] = i;
	
  REP(i,M){
	int a = xs[i].SS, b = xs[i].SS+1;
	l[a] = l[b] = min(l[a], l[b]);
	r[a] = r[b] = max(r[a], r[b]);
  }

  REP(i,N) cout << (i?" ":"") << (r[i+1]-l[i+1]+1);
  cout << endl;

  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;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, M; cin >> N >> M;
  vector<PII> xs(M);
  REP(i,M){
	cin >> xs[i];
  }
  SORT(xs);

  VI l(N+1), r(N+1);
  REP(i,N+1) l[i] = r[i] = i;
	
  REP(i,M){
	int a = xs[i].SS, b = xs[i].SS+1;
	l[a] = l[b] = min(l[a], l[b]);
	r[a] = r[b] = max(r[a], r[b]);
  }

  REP(i,N) cout << (i?" ":"") << (r[i+1]-l[i+1]+1);
  cout << endl;

  return 0;
}
```