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:
#define DEBUG 0

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

#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}

// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
    public:
        template<typename T>
        _Debug& operator,(T val) {
            cout << val << endl;
            return *this;
        }
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif

// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back

// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;

// ---------- END OF TEMPLATE ----------

int l[100000],r[100000];
int order[100000];
bool comp(int a,int b) {
    return r[a]-l[a] > r[b]-l[b];
}
int ans[50001];
priority_queue<pii,vpii,greater<pii> > H;
vi del[100000];
int parent[100000],in[100000],never[100000];
set<pair<pii,int> > S;
int tree[1 << 17],lazy[1 << 17];
int build(int s,int e,int i) {
    if (s == e) {
        tree[i] = 1e9,lazy[i] = -1;
        return 0;
    }

    int mid = (s+e) / 2;
    build(s,mid,2*i+1),build(mid+1,e,2*i+2);
    tree[i] = 1e9,lazy[i] = -1;
    return 0;
}
int prop(int s,int e,int i) {
    if (lazy[i] != -1) {
        tree[i] = lazy[i];
        if (s != e) lazy[2*i+1] = lazy[2*i+2] = lazy[i];
        lazy[i] = -1;
    }
    return 0;
}
int update(int s,int e,int as,int ae,int i,int num) {
    prop(s,e,i);
    if ((s > ae) || (e < as)) return 0;
    else if ((s >= as) && (e <= ae)) {
        lazy[i] = num;
        prop(s,e,i);
        return 0;
    }

    int mid = (s+e) / 2;
    update(s,mid,as,ae,2*i+1,num),update(mid+1,e,as,ae,2*i+2,num);
    tree[i] = min(tree[2*i+1],tree[2*i+2]);
    return 0;
}
int query(int s,int e,int qs,int qe,int i) {
    prop(s,e,i);
    if ((s > qe) || (e < qs)) return 1e9;
    else if ((s >= qs) && (e <= qe)) return tree[i];

    int mid = (s+e) / 2;
    return min(query(s,mid,qs,qe,2*i+1),query(mid+1,e,qs,qe,2*i+2));
}
int inter(pii a,pii b) {
    return !((a.second < b.first) || (b.second < a.first));
}
int seen[100000];
int main() {
    int i;
    int n,m;
    scanf("%d %d",&n,&m);
    for (i = 0; i < m; i++) {
        scanf("%d %d",&l[i],&r[i]),l[i]--,r[i]--;
        //l[i] = rand() % n;
        //r[i] = rand() % n;
        //if (l[i] > r[i]) swap(l[i],r[i]);
    }

    int j = 0,k;
    int sum = 0;
    for (i = 0; i < m; i++) order[i] = i,parent[i] = -1;
    sort(order,order+m,comp);
    build(0,n-1,0);
    for (i = n; i >= 1; i--) {
        while ((j < m) && (r[order[j]]-l[order[j]]+1 >= i)) {
            H.push(mp(order[j],1));
            j++;
        }
        set<pair<pii,int> > A;
        vi added;
        while (!H.empty()) {
            int u = H.top().first;
            int t = H.top().second;
            H.pop();

            if (t == -1) {
                sum -= r[u]-l[u]+1;
                auto it = A.upper_bound(mp(mp(l[u],1e9),1e9));
                if (it != A.begin()) {
                    it--;
                    if ((it->first.first <= l[u]) && (r[u] <= it->first.second)) {
                        if (del[it->second].size() < del[u].size()) swap(del[it->second],del[u]);
                        for (k = 0; k < del[u].size(); k++) del[it->second].pb(del[u][k]);
                        del[u].clear();
                        continue;
                    }
                }
                for (k = 0; k < del[u].size(); k++) {
                    seen[del[u][k]]++;
                    if (seen[del[u][k]] < 100) {
                        in[del[u][k]]--;
                        assert(del[u][k] > u);
                        if ((in[del[u][k]] == 0) && !never[del[u][k]]) H.push(mp(del[u][k],1));
                    }
                }
                del[u].clear();
            }
            else if (t == 1) {
                int q = query(0,n-1,l[u],r[u],0);
                if (q > u) {
                    added.pb(u),A.insert(mp(mp(l[u],r[u]),u));
                    sum += r[u]-l[u]+1;
                    auto it = S.upper_bound(mp(mp(l[u],1e9),1e9));
                    if (it != S.begin()) {
                        it--;
                        if (inter(it->first,mp(l[u],r[u]))) {
                            in[it->second]++,del[u].pb(it->second);
                            H.push(mp(it->second,-1));
                            update(0,n-1,it->first.first,it->first.second,0,1e9);
                            it = S.erase(it);
                        }
                        else it++;
                    }
                    while (it != S.end()) {
                        if (!inter(it->first,mp(l[u],r[u]))) break;
                        else {
                            in[it->second]++,del[u].pb(it->second);
                            H.push(mp(it->second,-1));
                            update(0,n-1,it->first.first,it->first.second,0,1e9);
                            it = S.erase(it);
                        }
                    }
                    update(0,n-1,l[u],r[u],0,u),S.insert(mp(mp(l[u],r[u]),u));
                }
                else {
                    if (never[u]) continue;
                    auto it = S.lower_bound(mp(mp(l[u],0),0));
                    int L = 1e9,R = -1;
                    if ((it != S.end()) && (it->first.second <= r[u])) L = it->first.first;
                    it = S.upper_bound(mp(mp(r[u],1e9),1e9));
                    if (it != S.begin()) {
                        it--;
                        if (it->first.first >= l[u]) R = it->first.second;
                    }
                    int qq = query(0,n-1,L,R,0);
                    if (qq < u) never[u] = 1;
                    else del[q].pb(u),in[u]++;
                }
            }
        }
        for (k = 0; k < added.size(); k++) assert(S.count(mp(mp(l[added[k]],r[added[k]]),added[k])));
        ans[i] = sum;
/*
        int sum2 = 0;
        set<pii> SS;
        for (k = 0; k < m; k++) {
            if (r[k]-l[k]+1 >= i) {
                auto it = SS.lower_bound(mp(l[k],0));
                if ((it != SS.end()) && inter(*it,mp(l[k],r[k]))) continue;
                if (it != SS.begin()) {
                    it--;
                    if (inter(*it,mp(l[k],r[k]))) continue;
                }
                SS.insert(mp(l[k],r[k])),sum2 += r[k]-l[k]+1;
            }
        }
        assert(sum == sum2);*/
    }
    for (i = 1; i <= n; i++) printf("%d\n",ans[i]);

    return 0;
}