
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int main(void)
{
	vector<int>up, dn;
	int n, m;
	cin >> n >> m;
	up.resize(n, 1);
	dn.resize(n, 1);
	vector<pair<int, int>>xy;
	for (int i = 0; i < m; ++i)
	{
		int x, y; cin >> x >> y;
		xy.push_back(make_pair(-x, y));
	}
	sort(xy.begin(), xy.end());
	for (auto p : xy)
	{
		int d = p.second;
		up[d - 1] += up[d];
		up[d] = 0;
		dn[d] += dn[d - 1];
		dn[d - 1] = 0;
	}
	vector<int>uu, dd;
	for (int i = 0; i < n; ++i)
	{
		while (up[i])
		{
			--up[i];
			uu.push_back(i);
		}
		while (dn[i])
		{
			--dn[i];
			dd.push_back(i);
		}
	}
	for (int i = 0; i < n; ++i)
	{
		cout << dd[i] - uu[i] + 1 << " \n"[i == n - 1];
	}
	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 <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int main(void)
{
	vector<int>up, dn;
	int n, m;
	cin >> n >> m;
	up.resize(n, 1);
	dn.resize(n, 1);
	vector<pair<int, int>>xy;
	for (int i = 0; i < m; ++i)
	{
		int x, y; cin >> x >> y;
		xy.push_back(make_pair(-x, y));
	}
	sort(xy.begin(), xy.end());
	for (auto p : xy)
	{
		int d = p.second;
		up[d - 1] += up[d];
		up[d] = 0;
		dn[d] += dn[d - 1];
		dn[d - 1] = 0;
	}
	vector<int>uu, dd;
	for (int i = 0; i < n; ++i)
	{
		while (up[i])
		{
			--up[i];
			uu.push_back(i);
		}
		while (dn[i])
		{
			--dn[i];
			dd.push_back(i);
		}
	}
	for (int i = 0; i < n; ++i)
	{
		cout << dd[i] - uu[i] + 1 << " \n"[i == n - 1];
	}
	return 0;
}
```