#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  int n, m;
  cin >> n >> m;

  vector<vector<int>> dp(n, vector<int>(2, 0));
  vector<pii> v(m);
  for (int i = 0; i < m; i++) {
    cin >> v[i].first >> v[i].second;
    v[i].second--;
  }
  sort(v.begin(), v.end());

  for (int i = 0; i < m; i++) {
    int pos = v[i].second;
    dp[pos][1] = dp[pos + 1][1] + 1;
    dp[pos + 1][0] = dp[pos][0] + 1;
  }

  for (int i = 0; i < n; i++) {
    cout << dp[i][0] + dp[i][1] + 1 << (i + 1 == n ? '\n' : ' ');
  }
  
  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 <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  int n, m;
  cin >> n >> m;

  vector<vector<int>> dp(n, vector<int>(2, 0));
  vector<pii> v(m);
  for (int i = 0; i < m; i++) {
    cin >> v[i].first >> v[i].second;
    v[i].second--;
  }
  sort(v.begin(), v.end());

  for (int i = 0; i < m; i++) {
    int pos = v[i].second;
    dp[pos][1] = dp[pos + 1][1] + 1;
    dp[pos + 1][0] = dp[pos][0] + 1;
  }

  for (int i = 0; i < n; i++) {
    cout << dp[i][0] + dp[i][1] + 1 << (i + 1 == n ? '\n' : ' ');
  }
  
  return 0;
}

```