#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps=1e-8;
int main() {
	int n, m; cin >> n >> m;
	int out[200000];
	fill(out, out + n, 1);
	vector<P> machine; int d, x;
	rep(i, m) {
		cin >> d >> x; x--;
		machine.push_back({ d,x });
	}
	sort(machine.begin(), machine.end());
	int memo[200000] = {};
	rep(i, m) {
		int loc = machine[i].second;
		int r = out[loc] + out[loc+1]-2*memo[loc];
		out[loc] = out[loc + 1] = r+memo[loc];
		memo[loc] += r;
	}
	rep(i, n) {
		cout << out[i];
		if (i < n - 1) {
			cout << " ";
		}
	}
	cout << endl;
	return 0;
}

### Prompt

Please formulate a Cpp solution to the following problem:

Example

Input

4 3
1000 1
2000 2
3000 3


Output

2 3 4 4

### Response

```cpp
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps=1e-8;
int main() {
	int n, m; cin >> n >> m;
	int out[200000];
	fill(out, out + n, 1);
	vector<P> machine; int d, x;
	rep(i, m) {
		cin >> d >> x; x--;
		machine.push_back({ d,x });
	}
	sort(machine.begin(), machine.end());
	int memo[200000] = {};
	rep(i, m) {
		int loc = machine[i].second;
		int r = out[loc] + out[loc+1]-2*memo[loc];
		out[loc] = out[loc + 1] = r+memo[loc];
		memo[loc] += r;
	}
	rep(i, n) {
		cout << out[i];
		if (i < n - 1) {
			cout << " ";
		}
	}
	cout << endl;
	return 0;
}

```