Problem: <image>

William owns a flat in central London. He decided to rent his flat out for the next n days to earn some money.

Since his flat is in the center of the city, he instantly got m offers in the form (l_i, r_i), which means that someone wants to book the flat from day l_i until day r_i inclusive. To avoid spending a lot of time figuring out whether it's profitable for him to accept an offer, William decided to develop an algorithm. The algorithm processes all offers as they arrive and will only accept offer i if the following two conditions are satisfied:

  * r_i - l_i + 1 ≥ x. 
  * None of the days between l_i and r_i are occupied by a previously accepted offer 



William isn't sure what value x should have and he asks you for help. For all x from 1 to n he wants you to calculate the total number of days for which the flat would be occupied if the corresponding value will be assigned to x.

Input

The first line contains two integers n and m (1 ≤ n ≤ 5 ⋅ 10^4, 1 ≤ m ≤ 10^5), which are the number of days and the number of offers, respectively.

Each of the next m lines contains two integers l_i and r_i (1 ≤ l_i ≤ r_i ≤ n), which describe the i-th renting offer. All offers are given in chronological order.

Output

Print n integers. The number in i-th line must be equal to the number of days the flat would be occupied if the algorithm will use the value of x equal to i.

Example

Input


6 5
2 3
3 5
1 1
1 5
1 6


Output


3
2
3
5
5
6

Note

The description of segments from the first sample test for each x: 

  * x = 1 — algorithm will approve offers: 1 (2..3), 3 (1..1). The total number of days for which William's flat will be rented out is 3 
  * x = 2 — algorithm will approve offers: 1 (2..3). The total number of days for which William's flat will be rented out is 2 
  * x = 3 — algorithm will approve offers: 2 (3..5). The total number of days for which William's flat will be rented out is 3 
  * x = 4 — algorithm will approve offers: 4 (1..5). The total number of days for which William's flat will be rented out is 5 
  * x = 5 — algorithm will approve offers: 4 (1..5). The total number of days for which William's flat will be rented out is 5 
  * x = 6 — algorithm will approve offers: 5 (1..6). The total number of days for which William's flat will be rented out is 6 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000;
//https://ei1333.github.io/luzhiled/snippets/structure/segment-tree.html
template< typename Monoid >
struct SegmentTree {
  using F = function< Monoid(Monoid, Monoid) >;

  int sz;
  vector< Monoid > seg;

  const F f;
  const Monoid M1;

  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }

  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }

  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }

  template< typename C >
  int find_subtree(int a, const C &check, Monoid &M, bool type) {
    while(a < sz) {
      Monoid nxt = type ? f(seg[2 * a + type], M) : f(M, seg[2 * a + type]);
      if(check(nxt)) a = 2 * a + type;
      else M = nxt, a = 2 * a + 1 - type;
    }
    return a - sz;
  }


  template< typename C >
  int find_first(int a, const C &check) {
    Monoid L = M1;
    if(a <= 0) {
      if(check(f(L, seg[1]))) return find_subtree(1, check, L, false);
      return -1;
    }
    int b = sz;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) {
        Monoid nxt = f(L, seg[a]);
        if(check(nxt)) return find_subtree(a, check, L, false);
        L = nxt;
        ++a;
      }
    }
    return -1;
  }

  template< typename C >
  int find_last(int b, const C &check) {
    Monoid R = M1;
    if(b >= sz) {
      if(check(f(seg[1], R))) return find_subtree(1, check, R, true);
      return -1;
    }
    int a = sz;
    for(b += sz; a < b; a >>= 1, b >>= 1) {
      if(b & 1) {
        Monoid nxt = f(seg[--b], R);
        if(check(nxt)) return find_subtree(b, check, R, true);
        R = nxt;
      }
    }
    return -1;
  }
};
template< typename structure_t, typename get_t, typename update_t >
struct SegmentTree2DCompressed {

  using merge_f = function< get_t(get_t, get_t) >;
  using range_get_f = function< get_t(structure_t &, int, int) >;
  using update_f = function< void(structure_t &, int, update_t) >;

  int sz;
  vector< structure_t > seg;
  const merge_f f;
  const range_get_f g;
  const update_f h;
  const get_t identity;
  vector< vector< int > > LL, RR;
  vector< vector< int > > beet;

  SegmentTree2DCompressed(int n, const merge_f &f, const range_get_f &g, const update_f &h, const get_t &identity)
      : f(f), g(g), h(h), identity(identity) {
    sz = 1;
    while(sz < n) sz <<= 1;
    beet.resize(2 * sz);
    LL.resize(2 * sz);
    RR.resize(2 * sz);
  }

  void update(int a, int x, update_t z, int k, int l, int r) {
    if(r <= a || a + 1 <= l) return;
    if(a <= l && r <= a + 1) return h(seg[k], x, z);
    update(a, LL[k][x], z, 2 * k + 0, l, (l + r) >> 1);
    update(a, RR[k][x], z, 2 * k + 1, (l + r) >> 1, r);
    return h(seg[k], x, z);
  }

  void update(int x, int y, update_t z) {
    y = lower_bound(begin(beet[1]), end(beet[1]), y) - begin(beet[1]);
    return update(x, y, z, 1, 0, sz);
  }

  get_t query(int a, int b, int x, int y, int k, int l, int r) {
    if(a >= r || b <= l) return identity;
    if(a <= l && r <= b) return g(seg[k], x, y);
    return f(query(a, b, LL[k][x], LL[k][y], 2 * k + 0, l, (l + r) >> 1),
             query(a, b, RR[k][x], RR[k][y], 2 * k + 1, (l + r) >> 1, r));
  }

  get_t query(int a, int b, int x, int y) {
    x = lower_bound(begin(beet[1]), end(beet[1]), x) - begin(beet[1]);
    y = lower_bound(begin(beet[1]), end(beet[1]), y) - begin(beet[1]);
    return query(a, b, x, y, 1, 0, sz);
  }

  void build() {
    for(int k = (int) beet.size() - 1; k >= sz; k--) {
      sort(begin(beet[k]), end(beet[k]));
      beet[k].erase(unique(begin(beet[k]), end(beet[k])), end(beet[k]));
    }
    for(int k = sz - 1; k > 0; k--) {
      beet[k].resize(beet[2 * k + 0].size() + beet[2 * k + 1].size());
      merge(begin(beet[2 * k + 0]), end(beet[2 * k + 0]), begin(beet[2 * k + 1]), end(beet[2 * k + 1]), begin(beet[k]));
      beet[k].erase(unique(begin(beet[k]), end(beet[k])), end(beet[k]));
      LL[k].resize(beet[k].size() + 1);
      RR[k].resize(beet[k].size() + 1);
      int tail1 = 0, tail2 = 0;
      for(int i = 0; i < beet[k].size(); i++) {
        while(tail1 < beet[2 * k + 0].size() && beet[2 * k + 0][tail1] < beet[k][i]) ++tail1;
        while(tail2 < beet[2 * k + 1].size() && beet[2 * k + 1][tail2] < beet[k][i]) ++tail2;
        LL[k][i] = tail1, RR[k][i] = tail2;
      }
      LL[k][beet[k].size()] = (int) beet[2 * k + 0].size();
      RR[k][beet[k].size()] = (int) beet[2 * k + 1].size();
    }
    for(int k = 0; k < beet.size(); k++) {
      seg.emplace_back(structure_t(beet[k].size(), f, identity));
    }
  }

  void preupdate(int x, int y) {
    beet[x + sz].push_back(y);
  }
};
int dfs(SegmentTree2DCompressed<SegmentTree<int>, int, int> &ST, vector<int> &l, vector<int> &r, int L, int R){
  int mn = ST.query(L, R + 1, L, R + 1);
  if (mn == INF){
    return 0;
  }
  int ans = r[mn] - l[mn];
  ans += dfs(ST, l, r, L, l[mn]);
  ans += dfs(ST, l, r, r[mn], R);
  return ans;
}
int main(){
  int n, m;
  cin >> n >> m;
  vector<int> l(m), r(m);
  for (int i = 0; i < m; i++){
    cin >> l[i] >> r[i];
    l[i]--;
  }
  vector<vector<int>> id(n);
  for (int i = 0; i < m; i++){
    id[r[i] - l[i] - 1].push_back(i);
  }
  auto f = [](int x, int y){
    return min(x, y);
  };
  auto g = [](SegmentTree<int> &ST, int x, int y){
    return ST.query(x, y);
  };
  auto h = [](SegmentTree<int> &ST, int x, int y){
    ST.update(x, min(ST[x], y));
  };
  SegmentTree2DCompressed<SegmentTree<int>, int, int> ST(n + 1, f, g, h, INF);
  for (int i = 0; i < m; i++){
    ST.preupdate(l[i], r[i]);
  }
  ST.build();
  vector<int> ans(n);
  for (int i = n - 1; i >= 0; i--){
    for (int j : id[i]){
      ST.update(l[j], r[j], j);
    }
    ans[i] = dfs(ST, l, r, 0, n);
  }
  for (int i = 0; i < n; i++){
    cout << ans[i] << "\n";
  }
}