#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#define ri register int
#define pi acos(-1.0)

using namespace std;

inline char gch()
{
    static char buf[100010], *h = buf, *t = buf;
    return h == t && (t = (h = buf) + fread(buf, 1, 100000, stdin), h == t) ? EOF : *h ++;
}

typedef long long lo;

typedef unsigned int uint;

template<typename inp_typ>

inline void re(inp_typ &x)
{
    x = 0;
    char a; bool b = 0;
    while(!isdigit(a = getchar()))
        b = a == '-';
    while(isdigit(a))
        x = x * 10 + a - '0', a = getchar();
    if(b == 1)
        x = - x;
}

int n, m, a[200020], toR[200020], ans[200020], toL[200020], fa[200020], L[200020], R[200020], LL[200020], RR[200020];

vector<pair<int, int> >mmp[200020];

bool visl[200020], visr[200020];

struct node
{
    int x, y;
}poi[200020];

inline bool cmp(node a, node b)
{
    return a.x < b.x;
}

int find(int x)
{
    return fa[x] == x ? x : fa[x] = find(fa[x]);
}

void dfsl(int x)
{
	visl[x] = 1;
	if(!toL[x])
		return;
	else if(visl[toL[x]])
		L[x] = min(L[x], L[toL[x]]);
	else
		dfsl(toL[x]), L[x] = min(L[x], L[toL[x]]);
}

void dfsr(int x)
{
	visr[x] = 1;
	if(!toR[x])
		return;
	else if(visr[toR[x]])
		R[x] = max(R[x], R[toR[x]]);
	else
		dfsr(toR[x]), R[x] = max(R[x], R[toR[x]]);
}

int main()
{
    re(n), re(m);
    for(ri i = 1; i <= m; i ++)
        re(poi[i].x), re(poi[i].y), mmp[poi[i].y].push_back(make_pair(poi[i].x, i)), L[i] = poi[i].y, R[i] = poi[i].y + 1;
    for(ri i = 1; i < n; i ++)
        mmp[i].push_back(make_pair(1e9 + 7, -1)), mmp[i].push_back(make_pair(0, -1)), sort(mmp[i].begin(), mmp[i].end());
    for(ri i = 1; i < n - 1; i ++)
        for(ri j = 0; j < mmp[i].size(); j ++)
        {
            int ll = 0, rr = mmp[i + 1].size() - 1, pos = 0;
            while(ll <= rr)
            {
            	int mid = (ll + rr) >> 1;
            	if(mmp[i + 1][mid].first > mmp[i][j].first)
            		rr = mid - 1;
            	else
            		ll = mid + 1, pos = mid;
            }
            if(pos == 0)
            	continue;
            toR[mmp[i][j].second] = mmp[i + 1][pos].second;
           // pair<int, int>qwq = *it;
        }
	for(ri i = n - 1; i > 1; i --)
		for(ri j = 0; j < mmp[i].size(); j ++)
		{
			int ll = 0, rr = mmp[i - 1].size() - 1, pos = 0;
            while(ll <= rr)
            {
            	int mid = (ll + rr) >> 1;
            	if(mmp[i - 1][mid].first > mmp[i][j].first)
            		rr = mid - 1;
            	else
            		ll = mid + 1, pos = mid;
            }
            if(pos == 0)
            	continue;
            toL[mmp[i][j].second] = mmp[i - 1][pos].second;
		} 
	for(ri i = 1; i <= m; i ++)
	{
		if(!visl[i])
			dfsl(i);
		if(!visr[i])
			dfsr(i);
	}
	for(ri i = 1; i <= n; i ++)
		LL[i] = i, RR[i] = i;
	for(ri i = 1; i <= m; i ++)
	{
		LL[poi[i].y] = min(LL[poi[i].y], L[i]), RR[poi[i].y] = max(RR[poi[i].y], R[i]);
		LL[poi[i].y + 1] = min(LL[poi[i].y + 1], L[i]), RR[poi[i].y + 1] = max(RR[poi[i].y + 1], R[i]);
	} //ans[poi[i].y] = max(ans[poi[i].y], R[i] - L[i] + 1), ans[poi[i].y + 1] = max(ans[poi[i].y + 1], R[i] - L[i] + 1);
	for(ri i = 1; i <= n; i ++)
	{
		//cout << i << ' ' << LL[i] << ' ' << RR[i] << '\n';
		printf("%d", RR[i] - LL[i] + 1);
		if(i != n)
			printf(" ");
	}
	printf("\n");
}


Measured memory_bytes: 19572