#include <vector>
#include <iostream>
#include <algorithm>

typedef long long int64;

void GeneratePrimes(int size, std::vector<int> &primes, std::vector<int> &factors)
{
	std::vector<bool> flag(size + 1, false);
	primes.clear();
	factors.resize(flag.size());

	for (int i = 2; i <= size; i++)
	{
		if (!flag[i])
		{
			flag[i] = true;
			primes.push_back(i);
			factors[i] = primes.size() - 1;
		}

		for (size_t j = 0; j < primes.size(); j++)
		{
			int next = primes[j] * i;
			if (next > size)
			{
				break;
			}
			flag[next] = true;
			factors[next] = j;
			if (i % primes[j] == 0)
			{
				break;
			}
		}
	}
}

int main()
{
	size_t k;
	std::cin >> k;
	std::vector<int> inputs(k);
	for (size_t i = 0; i < k; i++)
	{
		std::cin >> inputs[i];
	}
	std::sort(inputs.begin(), inputs.end());
	int max = inputs.back();

	std::vector<int> primes, factors;
	GeneratePrimes(max, primes, factors);

	std::vector<int64> deltas(max + 1);
	for (size_t i = k - 1; i > 0; i--)
	{
		if (inputs[i] != inputs[i - 1])
		{
			std::fill(deltas.begin() + inputs[i - 1] + 1, deltas.begin() + inputs[i] + 1, k - i);
		}
	}
	std::fill(deltas.begin() + 2, deltas.begin() + inputs[0] + 1, k);

	std::vector<int64> counts(primes.size(), 0);
	for (size_t i = max; i >= 2; i--)
	{
		counts[factors[i]] += deltas[i];
		deltas[i / primes[factors[i]]] += deltas[i];
	}

	int64 low = 1, up = std::numeric_limits<int64>::max();
	while (low < up)
	{
		bool isBreak = false;
		int64 middle = (up - low) / 2 + low;

		for (size_t j = 0; j < primes.size(); j++)
		{
			int prime = primes[j];
			int64 count = 0;

			for (int64 v = middle / prime; v > 0; v /= prime)
			{
				count += v;
			}

			if (count < counts[j])
			{
				low = middle + 1;
				isBreak = true;

				break;
			}
		}

		if (!isBreak)
		{
			up = middle;
		}
	}

	std::cout << up << std::endl;
}


#include <cstdio>
#include <iostream>

const long maxv = 10000001;

bool prime[10000010];
long p[1000010], q[1000010], f[10000010];
long tq[1000010];
long tot;
long plus[10000010];
long n;
long long l = 1, r = 1, mid = 0;

bool check(long long x)
{
	long long temp;

	for (long i = 0; i < tot; ++i)
	{
		temp = x; tq[i] = 0;
		while (temp)
			tq[i] += temp = temp / p[i];
		if (tq[i] < q[i]) return false;
	}

	return true;
}

int main()
{
	long temp;

	//freopen("E.in", "r", stdin);
	//freopen("E.out", "w", stdout);

	scanf("%d", &n);

	for (long i = 0; i < n; ++i)
	{
		scanf("%d", &temp);
		r += temp;
		++plus[temp];
	}

	for (long i = maxv - 1; i > 0; --i)
		plus[i] += plus[i + 1];

	for (long i = 2; i < maxv; ++i)
	{
		if (!prime[i])
		{
			f[i] = maxv + tot;
			p[tot++] = i;
		}
		for (long j = 0; j < tot; ++j)
		{
			if (i * p[j] >= maxv) break;
			prime[i * p[j]] = true;
			f[i * p[j]] = p[j];
			if (i % p[j] == 0) break;
		}
	}

	for (long i = maxv - 1; i > 1; --i)
		if (f[i] < maxv)	plus[i / f[i]] += plus[i];

	for (long i = 2; i < maxv; ++i)
		if (f[i] >= maxv) q[f[i] - maxv] += plus[i];
		else q[f[f[i]] - maxv] += plus[i];

	while (r - l > 1)
	{
		mid = (l + r) / 2;
		if (check(mid)) r = mid; else l = mid;
	}
	if (check(l)) std::cout << l;
	else std::cout << r;

	return 0;
}


#include <cstdio>
#include <iostream>

const long maxv = 10000001;

bool prime[10000010];
long p[1000010], f[10000010];
long long q[1000010], tq[1000010];
long tot;
long long plus[10000010];
long n;
long long l = 1, r = 1, mid = 0;

bool check(long long x)
{
	long long temp;

	for (long i = 0; i < tot; ++i)
	{
		temp = x; tq[i] = 0;
		while (temp)
			tq[i] += temp = temp / p[i];
		if (tq[i] < q[i]) return false;
	}

	return true;
}

int main()
{
	long temp;

	//freopen("E.in", "r", stdin);
	//freopen("E.out", "w", stdout);

	scanf("%d", &n);

	for (long i = 0; i < n; ++i)
	{
		scanf("%d", &temp);
		r += temp;
		++plus[temp];
	}

	for (long i = maxv - 1; i > 0; --i)
		plus[i] += plus[i + 1];

	for (long i = 2; i < maxv; ++i)
	{
		if (!prime[i])
		{
			f[i] = maxv + tot;
			p[tot++] = i;
		}
		for (long j = 0; j < tot; ++j)
		{
			if (i * p[j] >= maxv) break;
			prime[i * p[j]] = true;
			f[i * p[j]] = p[j];
			if (i % p[j] == 0) break;
		}
	}

	for (long i = maxv - 1; i > 1; --i)
		if (f[i] < maxv)	plus[i / f[i]] += plus[i];

	for (long i = 2; i < maxv; ++i)
		if (f[i] >= maxv) q[f[i] - maxv] += plus[i];
		else q[f[f[i]] - maxv] += plus[i];

	while (r - l > 1)
	{
		mid = (l + r) / 2;
		if (check(mid)) r = mid; else l = mid;
	}
	if (check(l)) std::cout << l;
	else std::cout << r;

	return 0;
}


#include <cstdio>
#include <iostream>

const long maxv = 10000000;

bool prime[10000010];
long from[10000010];
long p[1000000];
long q[1000000];

long long ans;
long n, temp, tot;

/*void prepare()
{
	tot = 0;
	for (long i = 2; i <= maxv; ++i)
	{
		if (!prime[i])
		{
			from[i] = tot;
			p[tot++] = i;
		}
		for (long j = 0; j < tot; ++j)
		{
			if (i * p[j] > maxv) break;
			prime[i * p[j]] = true;
			from[i * p[j]] = j;
			if (i % p[j] == 0) break;
		}
	}
}

bool check(long long x)
{
	long long temp, com;
	for (long i = 0; i < tot; ++i)
	{
		com = 0;
		temp = x;
		while (temp)
		{
			com += temp / p[i];
			temp /= p[i];
		}
		if (com < q[i]) return false;
	}
	return true;
}*/

int main()
{
	//freopen("E.in", "r", stdin);
	//freopen("E.out", "w", stdout);

	//prepare();

	scanf("%d", &n);

	for (long i = 0; i < n; ++i)
	{
		scanf("%d", &temp);
		ans += temp;
	}

	std::cout << ans;
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <string>
#include <string.h>
#include <queue>
#include <set>
#include <complex>
#include <iostream>
#include <fstream>
#include <time.h>
#include <functional>
using namespace std;
vector<int> prime;
vector<int> f;
void Init_prime(int N)
{
    prime.clear();
    f=vector<int>(N+1,0);
    for(int i=2;i<=N;i++)
    {
        if(f[i])
        {
            for(int j=0;j<prime.size()&&prime[j]*i<=N;j++)
            {
                f[prime[j]*i]=prime[j];
                if(i%prime[j]==0) break;
            }
        }
        else
        {
            f[i]=i;
            prime.push_back(i);
            for(int j=0;j<prime.size()&&prime[j]*i<=N;j++) f[prime[j]*i]=prime[j];
        }
    }
}
int a[1000000];
long long b[10000001];
int main()
{
    int n;
    scanf("%d",&n);
    long long mx=0,mn=1;
    for(int i=0;i<n;i++)
    {
        scanf("%d",a+i);
        mx+=a[i];
        b[a[i]]++;
    }
    sort(a,a+n);
    Init_prime(a[n-1]);
    for(int i=a[n-1]-1;i>=2;i--) b[i]+=b[i+1];
    vector<long long> cnt=vector<long long>(a[n-1]+1,0);
    for(int i=a[n-1];i>=2;i--)
    {
        cnt[f[i]]+=b[i];
        if(f[i]!=i) b[i/f[i]]+=b[i];
    }
    long long mid,tmp;
    while(mn<=mx)
    {
        mid=mn+mx>>1;
        bool ok=1;
        for(int i=0;i<prime.size();i++)
        {
            long long _cnt=0;
            tmp=mid;
            while(tmp) {tmp/=prime[i]; _cnt+=tmp;}
            if(_cnt<cnt[prime[i]]) {ok=0; break;}
        }
        if(ok) mx=mid-1;
        else mn=mid+1;
    }
    printf("%I64d\n",mx+1);
}


#include <cstdio>

const int N = (int)1e7 + 100;

int lp[N], simples[N], simsz;
long long cnt[N];
bool ok(long long mid) {
        bool can = true;
        for(int i = 0; i < simsz && can; i++) {
                long long tmp = mid, f = 0;
                while(tmp) {
                        tmp /= simples[i];
                        f += tmp;
                }
                if (f < cnt[i])
                        can = false;
        }
        return can;
}
int main() {
        int n, max = 0;
        scanf("%d", &n);
        long long rg = 0, lf = 1;
        for(int i = 0; i < n; ++i) {
                int a;
                scanf("%d", &a);
                if (a > max)
                        max = a;
                rg += a;
                ++cnt[a];
        }
        for(int i = 2; i <= max; ++i) {
                if (lp[i] == 0) {
                        lp[i] = i;
                        simples[simsz++] = i;
                }
                for(int j = 0; j < simsz && simples[j] <= lp[i] && (long long)i*simples[j]<=max; ++j) {
                        lp[i * simples[j]] = simples[j];
                }
        }
        for(int i = max; i>=2; i--)
                cnt[i] += cnt[i+1];
        for(int i = max; i>=2; i--) {
                if (lp[i] != i)
                        cnt[lp[i]] += cnt[i];
                cnt[i / lp[i]] += cnt[i];
        }
        for(int i = 0; i < simsz; i++) {
                cnt[i] = cnt[simples[i]];
        }
        while (rg != lf) {
                long long mid = (rg+lf)>>1;
                if (ok(mid)) {
                        rg = mid;
                } else lf = mid + 1;
        }
        printf("%I64d", lf);
}


#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstdio>
#include<string.h>
#include<set>
#include<map>
using namespace std;

typedef long long Int;
#define FOR(i,a,b)  for(int i=(a);i<=(b);++i)
#define sz(s) (int)(s).size()
#define mp make_pair
#define pb push_back
void assert(bool x){if(!x)throw -1;}
const int inf = 1000000000;
const int MOD = 1000000007;
#define sqr(x) (x)*(x)
const double PI = acos(-1.0);

const int N = 10000009;

Int get(int val,int deg){
	Int low = 1,high=10000000000000LL;
	while(low<high){
		Int mid = ((low+high)>>1);

		Int now=0;
		Int f = val;
		for(;;){
			if(f>mid)break;
			now+=mid/f;
			f*=val;
		}

		if(now<deg)low = mid+1;else high = mid;
	}
	return low;
}

bool z[N];
int a[100009];
int more[N];

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	int n;cin>>n;
	FOR(i,1,n)cin>>a[i];

	memset(more,0,sizeof(more));
	FOR(i,1,n)more[a[i]]++;
	for(int i=N-2;i>=0;--i)more[i]+=more[i+1];

	FOR(i,2,10000)if(!z[i]){
		for(int j=i+i;j<=10000000;j+=i)z[j]=true;
	}

	Int ans=1;
	FOR(i,2,10000000)if(!z[i]){
		Int j=i;
		int need=0;
		for(;;){
			if(j>10000000)break;
			int w = j;
			for(;;){
				if(w>10000000)break;
				need+=more[w];
				w+=j;
			}
			j*=i;
		}
		//if(need)cout<<i<<" "<<need<<endl;
		ans = max(ans,get(i,need));
	}

	cout<<ans<<endl;
}


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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvs vector < vs >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

const int dx[] = { -1 , 0 , 1 , 0 } ;
const int dy[] = { 0 , 1 , 0 , -1 } ;

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .

vector < array < int , 3 > > v ;
int n , q , off ;

void read ()
{
    cin >> n >> q ;

    off = abs(1 - n) ;
    v.resize ( q ) ;

    for ( int i=0 ; i < q ; i ++ )
    {
        int x , y ;
        cin >> x >> y ;

        v[i] = { x , y , i } ;
    }
}

const int N = 1e5 + 10 ;

int attack[N] ;
bool row[N] , col[N] , diag[N] , back_diag[N] ;

void FILL ( bool *v )
{
    for ( int i=0 ; i < N ; i ++ )
        v[i] = false ;
}

void solve ( int test_case )
{
    read () ;
    sort ( all ( v ) ) ;

    for ( int i=0 ; i < q ; i ++ )
    {
        int x = v[i][0] ;
        int y = v[i][1] ;

        int indx = v[i][2] ;

        assert ( off + x - y >= 0 ) ;
        attack[indx] += row[x] + col[y] + diag[x + y] + back_diag[off + x - y] ;

//        cout << "indx : " << indx << " and attack : " << attack[indx] ; line ;

        row[x] = 1 ; col[y] = 1 ;

        diag[x + y] = 1 ;
        back_diag[off + x - y] = 1 ;
    }

    FILL ( row ) ; FILL ( col ) ; FILL ( diag ) ; FILL ( back_diag ) ;

//    for ( int i=0 ; i < q ; i ++ )
//        cout << attack[i] << " " ;

//    line ;

    for ( int i = q - 1 ; i > -1 ; i -- )
    {
        int x = v[i][0] ;
        int y = v[i][1] ;

        int indx = v[i][2] ;

        assert ( off + x - y >= 0 ) ;
        attack[indx] += row[x] + col[y] + diag[x + y] + back_diag[off + x - y] ;

//        cout << "indx : " << indx << " and attack : " << attack[indx] ; line ;

        row[x] = 1 ; col[y] = 1 ;

        diag[x + y] = 1 ;
        back_diag[off + x - y] = 1 ;
    }

    vi ans ( 8 ) ;

    for ( int i=0 ; i < q ; i ++ )
    {
        ans[attack[i]] ++ ;
    }

    for ( int &i : ans )
        cout << i << " " ;

    line ;
}

int main()
{fast
    int t = 1;
    // cin >> t;

    for ( int i = 1 ; i <= t ; i ++ )
    {
        solve ( i ) ;
    }

    return 0;
}


// avvinci -  sem 8
// #include"prettyprint.hpp"
#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int , long long int> P;

#define mod 1000000007
#define pb push_back
#define mk make_pair
#define fs first
#define sc second
#define ll long long int
#define fr(it,st,en) for(it=st;it<en;it++)
#define all(container) container.begin(),container.end()
#define INP ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ws(x) cout << #x << " = " << x << endl
#define N 300004

const long long infl = 1e18+5;

ll n,m,k,q,x,y,f,val,t=1,i,j;
ll ind = -1,cnt,sz,sm,mx = -1,mn = infl ;
ll a[N] ,ans[8];
const int sh = 1e5 + 5 ;
vector < P > vx[N],vy[N],vd[N],vp[N] ;

int main(){
INP
if (fopen("inp.txt", "r")) {
    freopen("myfile.txt","w",stdout);
    freopen("inp.txt", "r", stdin);
}

cin>>n>>m;
map< P ,ll > mp ;
fr(i,0,m){
    cin>>x>>y;
    P p = {x,y} ;
    // v.pb(p);
    vx[x].pb(p) ;
    vy[y].pb(p) ;
    vp[x+y].pb(p) ;
    vd[x-y+sh].pb(p) ;
}
fr(i,0,N){
    sort(all(vx[i])) ;
    sort(all(vy[i])) ;
    sort(all(vp[i])) ;
    sort(all(vd[i])) ;
    fr(j,1,vx[i].size()){
        mp[vx[i][j]]++ ;
        mp[vx[i][j-1]]++;
    }
    fr(j,1,vy[i].size()){
        mp[vy[i][j]]++;
        mp[vy[i][j-1]]++ ;
    }
    fr(j,1,vd[i].size()){
        mp[vd[i][j]]++;
        mp[vd[i][j-1]]++;
    }
    fr(j,1,vp[i].size()){
        mp[vp[i][j]]++;
        mp[vp[i][j-1]]++;
    }
}
for(auto it:mp){
    ans[it.sc]++;
}
fr(i,0,8) cout<<ans[i]<<" " ;

return 0 ;
}


// avvinci -  sem 8
// #include"prettyprint.hpp"
#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int , long long int> P;

#define mod 1000000007
#define pb push_back
#define mk make_pair
#define fs first
#define sc second
#define ll long long int
#define fr(it,st,en) for(it=st;it<en;it++)
#define all(container) container.begin(),container.end()
#define INP ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ws(x) cout << #x << " = " << x << endl
#define N 300004

const long long infl = 1e18+5;

ll n,m,k,q,x,y,f,val,t=1,i,j;
ll ind = -1,cnt,sz,sm,mx = -1,mn = infl ;
ll a[N] ,ans[8];
const int sh = 1e5 + 5 ;
vector < P > vx[N],vy[N],vd[N],vp[N] ;

int main(){
INP
if (fopen("inp.txt", "r")) {
    freopen("myfile.txt","w",stdout);
    freopen("inp.txt", "r", stdin);
}

cin>>n>>m;
map< P ,ll > mp ;
fr(i,0,m){
    cin>>x>>y;
    P p = {x,y} ;
    // v.pb(p);
    vx[x].pb(p) ;
    vy[y].pb(p) ;
    vp[x+y].pb(p) ;
    vd[x-y+sh].pb(p) ;
}
fr(i,0,N){
    sort(all(vx[i])) ;
    sort(all(vy[i])) ;
    sort(all(vp[i])) ;
    sort(all(vd[i])) ;
    fr(j,1,vx[i].size()){
        mp[vx[i][j]]++ ;
        mp[vx[i][j-1]]++;
    }
    fr(j,1,vy[i].size()){
        mp[vy[i][j]]++;
        mp[vy[i][j-1]]++ ;
    }
    fr(j,1,vd[i].size()){
        mp[vd[i][j]]++;
        mp[vd[i][j-1]]++;
    }
    fr(j,1,vp[i].size()){
        mp[vp[i][j]]++;
        mp[vp[i][j-1]]++;
    }
}
ans[0] = m ;
for(auto it:mp){
    ans[it.sc]++;
    ans[0] -- ;
}
fr(i,0,9) cout<<ans[i]<<" " ;

return 0 ;
}


// avvinci -  sem 8
// #include"prettyprint.hpp"
#include<bits/stdc++.h>
using namespace std;

typedef pair<long long int , long long int> P;

#define mod 1000000007
#define pb push_back
#define mk make_pair
#define fs first
#define sc second
#define ll long long int
#define fr(it,st,en) for(it=st;it<en;it++)
#define all(container) container.begin(),container.end()
#define INP ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ws(x) cout << #x << " = " << x << endl
#define N 300004

const long long infl = 1e18+5;

ll n,m,k,q,x,y,f,val,t=1,i,j;
ll ind = -1,cnt,sz,sm,mx = -1,mn = infl ;
ll a[N] ,ans[8];
const int sh = 1e5 + 5 ;
vector < P > vx[N],vy[N],vd[N],vp[N] ;

int main(){
INP
if (fopen("inp.txt", "r")) {
    freopen("myfile.txt","w",stdout);
    freopen("inp.txt", "r", stdin);
}

cin>>n>>m;
map< P ,ll > mp ;
fr(i,0,m){
    cin>>x>>y;
    P p = {x,y} ;
    // v.pb(p);
    vx[x].pb(p) ;
    vy[y].pb(p) ;
    vp[x+y].pb(p) ;
    vd[x-y+sh].pb(p) ;
}
fr(i,0,N){
    sort(all(vx[i])) ;
    sort(all(vy[i])) ;
    sort(all(vp[i])) ;
    sort(all(vd[i])) ;
    fr(j,1,vx[i].size()){
        mp[vx[i][j]]++ ;
        mp[vx[i][j-1]]++;
    }
    fr(j,1,vy[i].size()){
        mp[vy[i][j]]++;
        mp[vy[i][j-1]]++ ;
    }
    fr(j,1,vd[i].size()){
        mp[vd[i][j]]++;
        mp[vd[i][j-1]]++;
    }
    fr(j,1,vp[i].size()){
        mp[vp[i][j]]++;
        mp[vp[i][j-1]]++;
    }
}
for(auto it:mp){
    ans[it.sc]++;
}
fr(i,0,9) cout<<ans[i]<<" " ;

return 0 ;
}


#include<bits/stdc++.h>

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();

using namespace std;
const int N=1e5+1, mod= 1e9+7;

struct st{
	int x,y,i;
	bool operator<(st a){
		return (x==a.x?y<a.x:x<a.x);
	}

};

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n,m;
	cin>>n>>m;
	vector<st> v1,v2;
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		v1.pb({x,y,i});
		v2.pb({y,x,i});
	}
	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());

	vector<int> temp(m),res(8);
	for(int i=0;i<m;i++){
		if(i!=0&&v1[i-1].x==v1[i].x) temp[v1[i].i]++;
		if(i!=m-1&&v1[i+1].x==v1[i].x) temp[v1[i].i]++;

		if(i!=0&&v2[i-1].x==v2[i].x) temp[v2[i].i]++;
		if(i!=m-1&&v2[i+1].x==v2[i].x) temp[v2[i].i]++;

	}

	map<int,int> sum,diff;
	for(int i=0;i<m;i++){
		int s= v1[i].x+v1[i].y,d= v1[i].x-v1[i].y;
		if( sum.count(s) ){
			temp[sum[s]]++;
			temp[v1[i].i]++;
		}
		sum[s]=v1[i].i;

		if( diff.count(d) ){
			temp[diff[d]]++;
			temp[v1[i].i]++;
		}
		diff[d]=v1[i].i;
	}
	for(auto x:temp)res[x]++;
	for(auto x:res)cout<<x<<" ";

    yogeshk972();
}


#include<bits/stdc++.h>

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();

using namespace std;
const int N=1e5+1, mod= 1e9+7;

struct st{
	int x,y,i;
	bool operator<(st a){
		return (x==a.x?y<a.x:x<a.x);
	}

};

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n,m;
	cin>>n>>m;
	vector<st> v1,v2;
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		v1.pb({x,y,i});
		v2.pb({y,x,i});
	}
	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());

	vector<int> temp(m),res(9);
	for(int i=0;i<m;i++){
		if(i!=0&&v1[i-1].x==v1[i].x) temp[v1[i].i]++;
		if(i!=m-1&&v1[i+1].x==v1[i].x) temp[v1[i].i]++;

		if(i!=0&&v2[i-1].x==v2[i].x) temp[v2[i].i]++;
		if(i!=m-1&&v2[i+1].x==v2[i].x) temp[v2[i].i]++;

	}

	map<int,int> sum,diff;
	for(int i=0;i<m;i++){
		int s= v1[i].x+v1[i].y,d= v1[i].x-v1[i].y;
		if( sum.count(s) ){
			temp[sum[s]]++;
			temp[v1[i].i]++;
		}
		sum[s]=v1[i].i;

		if( diff.count(d) ){
			temp[diff[d]]++;
			temp[v1[i].i]++;
		}
		diff[d]=v1[i].i;
	}
	for(auto x:temp)res[x]++;
	for(auto x:res)cout<<x<<" ";

    yogeshk972();
}


#include<bits/stdc++.h>

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();

using namespace std;
const int N=1e5+10, mod= 1e9+7;
vector<pair<int,int>> g1[N],g2[N];

struct st{
	int x,y,i;
	bool operator<(st a){
		return (x==a.x?y<a.x:x<a.x);
	}
};

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n,m;
	cin>>n>>m;
	vector<st> v;

	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		v.pb({x,y,i});
		g1[x].pb({y,i});
		g2[y].pb({x,i});
	}

	sort(v.begin(),v.end());
	vector<int> temp(m),res(9);

	for(int i=0;i<N;i++){
		if(g1[i].size()<2) continue;
		sort(g1[i].begin(),g1[i].end());

		for(int j=0;j<(int)g1[i].size();j++){
			if(j==0||j+1==(int)g1[i].size()) temp[g1[i][j].yy]++;
			else temp[g1[i][j].yy]+=2;
		}
	}

	for(int i=0;i<N;i++){
		if(g2[i].size()<2) continue;
		sort(g2[i].begin(),g2[i].end());

		for(int j=0;j<(int)g2[i].size();j++){
			if(j==0||j+1==(int)g2[i].size()) temp[g2[i][j].yy]++;
			else temp[g2[i][j].yy]+=2;
		}
	}

	map<int,int> sum,diff;
	for(int i=0;i<m;i++){
		int s= v[i].x+v[i].y,d= v[i].x-v[i].y;
		if( sum.count(s) ){
			temp[sum[s]]++;
			temp[v[i].i]++;
		}
		sum[s]=v[i].i;

		if( diff.count(d) ){
			temp[diff[d]]++;
			temp[v[i].i]++;
		}
		diff[d]=v[i].i;
	}

	for(auto x:temp)res[x]++;
	for(auto x:res)cout<<x<<" ";

    yogeshk972();
}


#include<bits/stdc++.h>

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();

using namespace std;
const int N=1e5+1, mod= 1e9+7;

struct st{
	int x,y,i;
	bool operator<(st a){
		return (x==a.x?y<a.x:x<a.x);
	}

};

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n,m;
	cin>>n>>m;
	vector<st> v1,v2;
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		v1.pb({x,y,i});
		v2.pb({y,x,i});
	}
	sort(v1.begin(),v1.end());
	sort(v2.begin(),v2.end());

	vector<int> temp(m),res(8);
	for(int i=0;i<m;i++){
		if(i!=0&&v1[i-1].x==v1[i].x) temp[v1[i].i]++;
		if(i!=n-1&&v1[i+1].x==v1[i].x) temp[v1[i].i]++;

		if(i!=0&&v2[i-1].x==v2[i].x) temp[v2[i].i]++;
		if(i!=n-1&&v2[i+1].x==v2[i].x) temp[v2[i].i]++;

	}

	map<int,int> sum,diff;
	for(int i=0;i<m;i++){
		int s= v1[i].x+v1[i].y,d= v1[i].x-v1[i].y;
		if( sum.count(s) ){
			temp[sum[s]]++;
			temp[v1[i].i]++;
		}
		sum[s]=v1[i].i;

		if( diff.count(d) ){
			temp[diff[d]]++;
			temp[v1[i].i]++;
		}
		diff[d]=v1[i].i;
	}
	for(auto x:temp)res[x]++;
	for(auto x:res)cout<<x<<" ";

    yogeshk972();
}


#include<bits/stdc++.h>

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();

using namespace std;
const int N=1e5+1, mod= 1e9+7;
vector<pair<int,int>> g1[N],g2[N];

struct st{
	int x,y,i;
	bool operator<(st a){
		return (x==a.x?y<a.x:x<a.x);
	}
};

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n,m;
	cin>>n>>m;
	vector<st> v;

	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		v.pb({x,y,i});
		g1[x].pb({y,i});
		g2[y].pb({x,i});
	}

	sort(v.begin(),v.end());

	vector<int> temp(m),res(9);
	for(int i=0;i<N;i++){
		if(g1[i].size()<2) continue;
		sort(g1[i].begin(),g1[i].end());
		for(int j=0;j<(int)g1[i].size();j++){
			if(j==0||j+1==(int)g1[i].size()) temp[g1[i][j].yy]++;
			else temp[g1[i][j].yy]+=2;
		}
	}

	for(int i=0;i<N;i++){
		if(g2[i].size()<2) continue;
		sort(g2[i].begin(),g2[i].end());
		for(int j=0;j<(int)g2[i].size();j++){
			if(j==0||j+1==(int)g2[i].size()) temp[g2[i][j].yy]++;
			else temp[g2[i][j].yy]+=2;
		}
	}

	map<int,int> sum,diff;
	for(int i=0;i<m;i++){
		int s= v[i].x+v[i].y,d= v[i].x-v[i].y;
		if( sum.count(s) ){
			temp[sum[s]]++;
			temp[v[i].i]++;
		}
		sum[s]=v[i].i;

		if( diff.count(d) ){
			temp[diff[d]]++;
			temp[v[i].i]++;
		}
		diff[d]=v[i].i;
	}
	for(auto x:temp)res[x]++;
	for(auto x:res)cout<<x<<" ";

    yogeshk972();
}


#include<bits/stdc++.h>

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();

using namespace std;
const int N=1e5+10, mod= 1e9+7;
vector<pair<int,int>> g1[N],g2[N];

struct st{
	int x,y,i;
	bool operator<(st a){
		return (x==a.x?y<a.y:x<a.x);
	}
};

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n,m;
	cin>>n>>m;
	vector<st> v;

	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		v.pb({x,y,i});
		g1[x].pb({y,i});
		g2[y].pb({x,i});
	}

	sort(v.begin(),v.end());
	vector<int> temp(m),res(9);

	for(int i=0;i<N;i++){
		if(g1[i].size()<2) continue;
		sort(g1[i].begin(),g1[i].end());

		for(int j=0;j<(int)g1[i].size();j++){
			if(j==0||j+1==(int)g1[i].size()) temp[g1[i][j].yy]++;
			else temp[g1[i][j].yy]+=2;
		}
	}

	for(int i=0;i<N;i++){
		if(g2[i].size()<2) continue;
		sort(g2[i].begin(),g2[i].end());

		for(int j=0;j<(int)g2[i].size();j++){
			if(j==0||j+1==(int)g2[i].size()) temp[g2[i][j].yy]++;
			else temp[g2[i][j].yy]+=2;
		}
	}

	map<int,int> sum,diff;
	for(int i=0;i<m;i++){
		int s= v[i].x+v[i].y,d= v[i].x-v[i].y;
		if( sum.count(s) ){
			temp[sum[s]]++;
			temp[v[i].i]++;
		}
		sum[s]=v[i].i;

		if( diff.count(d) ){
			temp[diff[d]]++;
			temp[v[i].i]++;
		}
		diff[d]=v[i].i;
	}

	for(auto x:temp) res[x]++;

	for(auto x:res)cout<<x<<" ";

    yogeshk972();
}


#include<bits/stdc++.h>
using namespace std;
#define unsync ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int main()
{
	unsync;

	int n, m, k;
	cin >> n >> m;
	int ans[9]={0};
	vector<int> x(m), y(m);
	vector<vector<int>> r(n), c(n), d1(2*n-1), d2(2*n-1);
	for(int i=0; i<m; i++) {
		cin >> x[i] >> y[i]; x[i]--; y[i]--;
		r[x[i]].push_back(y[i]);
		c[y[i]].push_back(x[i]);
		d1[x[i]+y[i]].push_back(x[i]-y[i]+n-1);
		d2[x[i]-y[i]+n-1].push_back(x[i]+y[i]);
	}
	for(auto s: r) sort(s.begin(), s.end());
	for(auto s: c) sort(s.begin(), s.end());
	for(auto s: d1) sort(s.begin(), s.end());
	for(auto s: d2) sort(s.begin(), s.end());

	for(int i=0; i<m; i++) {
		k = (r[x[i]].front() != y[i])
			+ (c[y[i]].front() != x[i])
			+ (d1[x[i]+y[i]].front() != x[i]-y[i]+n-1)
			+ (d2[x[i]-y[i]+n-1].front() != x[i]+y[i])
			+ (r[x[i]].back() != y[i])
			+ (c[y[i]].back() != x[i])
			+ (d1[x[i]+y[i]].back() != x[i]-y[i]+n-1)
			+ (d2[x[i]-y[i]+n-1].back() != x[i]+y[i]);
		ans[k]++;
	}
	for(int i=0; i<9; i++)
		cout << ans[i] <<" ";
	cout <<"\n";

	return 0;
}


//..............kanishk................//

 //#pragma GCC optimize("Ofast")
 //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
 //#pragma GCC optimize("unroll-loops")
// The simple the code, the better the speedup

  #include<bits/stdc++.h>
  #include <ext/pb_ds/assoc_container.hpp>
  #include <ext/pb_ds/tree_policy.hpp>

  using namespace std;
  using namespace __gnu_pbds;

    struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    };

  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

  typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    newset;

  #define ll            long long
 // #define int           long long
  #define pb            push_back
  #define ppb           pop_back
  #define si            set <ll>
  #define endl          '\n'
  #define F             first
  #define S             second
  #define mii           map<ll ,ll >
  #define umap          unordered_map<long long, int, custom_hash>
  #define msi           map<string,ll >
  #define rep(i,a,b)    for(ll  i=a;i<b;i++)
  #define all(v)        v.begin(),v.end()
  #define pii           pair<ll ,ll >
  #define vi            vector<ll >
  #define vii           vector<pair<ll , ll > >
  #define sz(x)         (ll )x.size()
  #define sl(x)          (ll )x.length()
  #define mp            make_pair
  #define sp(n)         setprecision(n)<<fixed
  #define spl           " "
  #define mod            998244353
  #define ios            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  const ll hell = (ll)1e9 + 7;
  //const ll inf = 3223372036854775807;
  const double PI = 3.14159265;

      #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
      template <typename Arg1>
      void __f(const char* name, Arg1&& arg1){
          std::cerr << name << " : " << arg1 << endl;
      }
      template <typename Arg1, typename... Args>
      void __f(const char* names, Arg1&& arg1, Args&&... args){
          const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
      }

/*-------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};          // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};          // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};   // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1};   // Knights Move
/*------------------------------------------------*/

  //#define abc   cin
  //#define qwe   cout

  ll power(ll base,ll exp,ll m) {
    ll res=1;
    while(exp>0) {
      if(exp%2==1) res=((res%m)*(base%m));
        base=((base%m)*(base%m));
        exp/=2;}
    return res%m;}
  ll modInverse(ll a, ll m) {
    return power(a, m-2,m);}

  //..............Code Begins Here................//
  const ll N = 1e5 + 5;
  ll n,k;
  ll m;

  int solve()
  {
    cin>>n>>m;
    ll rmi[N],rma[N],cmi[N],cma[N];
    map<ll,pii > d1,d2;
    umap ans;
    rep(i,0,N)
    {
      rmi[i]=hell;
      rma[i]=0;
      cmi[i]=hell;
      cma[i]=0;
    }
    for(ll i=-N;i<N;i++)
    {
      d1[i]={hell,(ll)0};
      d2[i]={hell,(ll)0};
    }
    ll x[N],y[N];
    rep(i,0,m)
    {

      cin>>x[i]>>y[i];
      rmi[y[i]]=min(rmi[y[i]],x[i]);
      rma[y[i]]=max(rma[y[i]],x[i]);
      cmi[x[i]]=min(cmi[x[i]],y[i]);
      cma[x[i]]=max(cma[x[i]],y[i]);
      d1[y[i]-x[i]].F=min(d1[y[i]-x[i]].F,y[i]);
      d1[y[i]-x[i]].S=max(d1[y[i]-x[i]].S,y[i]);
      d2[y[i]+x[i]].F=min(d2[y[i]+x[i]].F,y[i]);
      d2[y[i]+x[i]].S=max(d2[y[i]+x[i]].S,y[i]);
    }
    rep(i,0,m)
    {
      ll d=0;
      if(x[i]!=rmi[y[i]])
        d++;
      if(x[i]!=rma[y[i]])
        d++;
      if(y[i]!=cmi[x[i]])
        d++;
      if(y[i]!=cma[x[i]])
        d++;
      if(d1[y[i]-x[i]].F!=y[i])
        d++;
      if(d1[y[i]-x[i]].S!=y[i])
        d++;
      if(d2[y[i]+x[i]].F!=y[i])
        d++;
      if(d2[y[i]+x[i]].S!=y[i])
        d++;
     // trace(d);
      //trace(x[i],y[i],rmi[y[i]],rma[y[i]],cmi[x[i]],cma[x[i]]);
      ans[d]++;
    }
    rep(i,0,9)
    cout<<ans[i]<<spl;
  return 0;}

  signed main(){

    ios

    int test=1;
   // cin>>test;

    while(test--){
      solve();}

    return 0;}


//..............kanishk................//

 //#pragma GCC optimize("Ofast")
 //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
 //#pragma GCC optimize("unroll-loops")
// The simple the code, the better the speedup

  #include<bits/stdc++.h>
  #include <ext/pb_ds/assoc_container.hpp>
  #include <ext/pb_ds/tree_policy.hpp>

  using namespace std;
  using namespace __gnu_pbds;

    struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    };

  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

  typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    newset;

  #define ll            long long
 // #define int           long long
  #define pb            push_back
  #define ppb           pop_back
  #define si            set <ll>
  #define endl          '\n'
  #define F             first
  #define S             second
  #define mii           map<ll ,ll >
  #define umap          unordered_map<long long, int, custom_hash>
  #define msi           map<string,ll >
  #define rep(i,a,b)    for(ll  i=a;i<b;i++)
  #define all(v)        v.begin(),v.end()
  #define pii           pair<ll ,ll >
  #define vi            vector<ll >
  #define vii           vector<pair<ll , ll > >
  #define sz(x)         (ll )x.size()
  #define sl(x)          (ll )x.length()
  #define mp            make_pair
  #define sp(n)         setprecision(n)<<fixed
  #define spl           " "
  #define mod            998244353
  #define ios            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  const ll hell = (ll)1e9 + 7;
  //const ll inf = 3223372036854775807;
  const double PI = 3.14159265;

      #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
      template <typename Arg1>
      void __f(const char* name, Arg1&& arg1){
          std::cerr << name << " : " << arg1 << endl;
      }
      template <typename Arg1, typename... Args>
      void __f(const char* names, Arg1&& arg1, Args&&... args){
          const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
      }

/*-------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};          // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};          // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};   // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1};   // Knights Move
/*------------------------------------------------*/

  //#define abc   cin
  //#define qwe   cout

  ll power(ll base,ll exp,ll m) {
    ll res=1;
    while(exp>0) {
      if(exp%2==1) res=((res%m)*(base%m));
        base=((base%m)*(base%m));
        exp/=2;}
    return res%m;}
  ll modInverse(ll a, ll m) {
    return power(a, m-2,m);}

  //..............Code Begins Here................//
  const ll N = 1e5 + 5;
  ll n,k;
  ll m;

  int solve()
  {
    cin>>n>>m;
    ll rmi[N],rma[N],cmi[N],cma[N];
    mii d1mi,d1ma,d2mi,d2ma;
    umap ans;
    rep(i,0,N)
    {
      rmi[i]=hell;
      rma[i]=0;
      cmi[i]=hell;
      cma[i]=0;
    }
   // trace(-N);
    ll x[N],y[N];
    rep(i,0,m)
    {

      cin>>x[i]>>y[i];
      rmi[y[i]]=min(rmi[y[i]],x[i]);
      rma[y[i]]=max(rma[y[i]],x[i]);
      cmi[x[i]]=min(cmi[x[i]],y[i]);
      cma[x[i]]=max(cma[x[i]],y[i]);
      d1mi[y[i]-x[i]]=hell;//min(d1[y[i]-x[i]].F,y[i]);
      d1ma[y[i]-x[i]]=0;//max(d1[y[i]-x[i]].S,y[i]);
      d2mi[y[i]+x[i]]=hell;//min(d2[y[i]+x[i]].F,y[i]);
      d2ma[y[i]+x[i]]=0;//max(d2[y[i]+x[i]].S,y[i]);
    }
    rep(i,0,m)
    {
      d1mi[y[i]-x[i]]=min(d1mi[y[i]-x[i]],y[i]);
      d1ma[y[i]-x[i]]=max(d1ma[y[i]-x[i]],y[i]);
      d2mi[y[i]+x[i]]=min(d2mi[y[i]+x[i]],y[i]);
      d2ma[y[i]+x[i]]=max(d2ma[y[i]+x[i]],y[i]);
    }
    rep(i,0,m)
    {
      ll d=0;
      if(x[i]!=rmi[y[i]])
        d++;
      if(x[i]!=rma[y[i]])
        d++;
      if(y[i]!=cmi[x[i]])
        d++;
      if(y[i]!=cma[x[i]])
        d++;
      if(d1mi[y[i]-x[i]]!=y[i])
        d++;
      if(d1ma[y[i]-x[i]]!=y[i])
        d++;
      if(d2mi[y[i]+x[i]]!=y[i])
        d++;
      if(d2ma[y[i]+x[i]]!=y[i])
        d++;
     // trace(d);
      //trace(x[i],y[i],rmi[y[i]],rma[y[i]],cmi[x[i]],cma[x[i]]);
    //trace(d);
      ans[d]++;
    }

    rep(i,0,9)
    cout<<ans[i]<<spl;
  return 0;}

  signed main(){

    ios

    int test=1;
   // cin>>test;

    while(test--){
      solve();}

    return 0;}


#include <bits/stdc++.h>

using namespace std;
int m, n ;
bool attack[100000][8];
vector<pair<pair<int,int>,int> > X , Y ;
vector<pair<pair<int,int>,int> > D1 , D2 ;
int ans[9];
int main()
{
    cin >> n >> m ;
    for(int i = 0 ; i< m ; i++){
        int x , y ;
        cin >> x >> y ;
        X.push_back(make_pair(make_pair(x,y),i));
        Y.push_back(make_pair(make_pair(y,x),i));
        D1.push_back(make_pair(make_pair(x+y,x),i));
        D2.push_back(make_pair(make_pair(x-y,x),i));

    }
    sort(X.begin(),X.end());
    sort(Y.begin(),Y.end());
    sort(D1.begin(),D1.end());
    sort(D2.begin(),D2.end());
    /// 0 attack 3allisar , 1imin, 2 lfou9 , 3 louta,
    for(int i = 1 ; i<m ; i++){
        if(X[i].first.first==X[i-1].first.first) attack[X[i].second][0]=1 ;//, cout <<X[i].second << "  ihejem  "<< X[i-1].second <<endl ;
    }
    for(int i = 0 ; i<m-1 ; i++){
        if(X[i].first.first==X[i+1].first.first) attack[X[i].second][1]=1;// cout <<X[i].second << "  ihejem  "<< X[i+1].second <<endl;
    }
    for(int i = 1 ; i<m ; i++){
        if(Y[i].first.first==Y[i-1].first.first) attack[Y[i].second][2]=1;// cout <<Y[i].second << "  ihejem  "<< Y[i-1].second <<endl;
    }
    for(int i = 0 ; i<m-1 ; i++){
        if(Y[i].first.first==Y[i+1].first.first) attack[Y[i].second][3]=1;// cout <<Y[i].second << "  ihejem  "<< Y[i+1].second <<endl;
    }
    /// 4 attack 3allisar , 5 imin, 6 lfou9 , 7 louta,
    for(int i = 1 ; i<m ; i++){
        if(D1[i].first.first==D1[i-1].first.first) attack[D1[i].second][4]=1;// cout <<D1[i].second << "  ihe jem  "<< D1[i-1].second <<endl;
    }
    for(int i = 0 ; i<m-1 ; i++){
        if(D1[i].first.first==D1[i+1].first.first) attack[D1[i].second][5]=1;// cout <<D1[i].second << "  ihe jem  "<< D1[i+1].second <<endl;
    }
    for(int i = 1 ; i<m ; i++){
        if(D2[i].first.first==D2[i-1].first.first) attack[D2[i].second][6]=1;// cout <<D2[i].second << "  ihe jem  "<< D2[i-1].second <<endl;
    }
    for(int i = 0 ; i<m-1 ; i++){
        if(D2[i].first.first==D2[i+1].first.first) attack[D2[i].second][7]=1;// cout <<D2[i].second << "  ihe jem  "<< D2[i+1].second <<endl;
    }
    for(int i = 0 ; i<m ; i++){
        int a = 0 ;
        for(int j = 0 ; j < 8 ; j++) a+= attack[i][j];
        ans[a]++;
    }
     for(int j = 0 ; j <= 8 ; j++) cout << ans[j]<<' ' ;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int m, n ;
bool attack[100000][8];
vector<pair<pair<int,int>,int> > X , Y ;
vector<pair<pair<int,int>,int> > D1 , D2 ;
int ans[9];
int main()
{
    cin >> n >> m ;
    for(int i = 0 ; i< m ; i++){
        int x , y ;
        cin >> x >> y ;
        X.push_back(make_pair(make_pair(x,y),i));
        Y.push_back(make_pair(make_pair(y,x),i));
        D1.push_back(make_pair(make_pair(x+y,x),i));
        D2.push_back(make_pair(make_pair(x-y,x),i));

    }
    sort(X.begin(),X.end());
    sort(Y.begin(),Y.end());
    sort(D1.begin(),D1.end());
    sort(D2.begin(),D2.end());
    /// 0 attack 3allisar , 1imin, 2 lfou9 , 3 louta,
    for(int i = 1 ; i<m ; i++){
        if(X[i].first.first==X[i-1].first.first) attack[X[i].second][0]=1 ;//, cout <<X[i].second << "  ihejem  "<< X[i-1].second <<endl ;
    }
    for(int i = 0 ; i<m-1 ; i++){
        if(X[i].first.first==X[i+1].first.first) attack[X[i].second][1]=1;// cout <<X[i].second << "  ihejem  "<< X[i+1].second <<endl;
    }
    for(int i = 1 ; i<m ; i++){
        if(Y[i].first.first==Y[i-1].first.first) attack[Y[i].second][2]=1;// cout <<Y[i].second << "  ihejem  "<< Y[i-1].second <<endl;
    }
    for(int i = 0 ; i<m-1 ; i++){
        if(Y[i].first.first==Y[i+1].first.first) attack[Y[i].second][3]=1;// cout <<Y[i].second << "  ihejem  "<< Y[i+1].second <<endl;
    }
    /// 4 attack 3allisar , 5 imin, 6 lfou9 , 7 louta,
    for(int i = 1 ; i<m ; i++){
        if(D1[i].first.first==D1[i-1].first.first) attack[D1[i].second][4]=1;// cout <<D1[i].second << "  ihe jem  "<< D1[i-1].second <<endl;
    }
    for(int i = 0 ; i<m-1 ; i++){
        if(D1[i].first.first==D1[i+1].first.first) attack[D1[i].second][5]=1;// cout <<D1[i].second << "  ihe jem  "<< D1[i+1].second <<endl;
    }
    for(int i = 1 ; i<m ; i++){
        if(D2[i].first.first==D2[i-1].first.first) attack[D2[i].second][6]=1;// cout <<D2[i].second << "  ihe jem  "<< D2[i-1].second <<endl;
    }
    for(int i = 0 ; i<m-1 ; i++){
        if(D2[i].first.first==D2[i+1].first.first) attack[D2[i].second][7]=1;// cout <<D2[i].second << "  ihe jem  "<< D2[i+1].second <<endl;
    }
    for(int i = 0 ; i<m ; i++){
        int a = 0 ;
        for(int j = 0 ; j < 8 ; j++) a+= attack[i][j];
        ans[a]++;
    }
     for(int j = 0 ; j < 8 ; j++) cout << ans[j]<<' ' ;
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

template<class T> using OS = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ull unsigned long long

const int N = 2e5 + 5;
int cnt[N], n, m, x, y, out[10];
vector<vector<pair<int, int>>> V(N), H(N);
map<int, vector<pair<pair<int, int>, int>>> mp, mp2;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        V[x].push_back({y, i});
        H[y].push_back({x, i});
        mp[y - x].push_back({{x, y}, i});
        mp2[x + y].push_back({{x, y}, i});
    }

    for (int i = 0; i < N; i++) {
        sort(V[i].begin(), V[i].end());
        sort(H[i].begin(), H[i].end());

        for (int j = 0; j < V[i].size(); j++) {
            cnt[V[i][j].second] += 2 - (j == 0) - (j == V[i].size() - 1);
        }
        for (int j = 0; j < H[i].size(); j++) {
            cnt[H[i][j].second] += 2 - (j == 0) - (j == H[i].size() - 1);
        }
    }

    for (auto i : mp) {
        sort(i.second.begin(), i.second.end());
        for (int j = 0; j < i.second.size(); j++) {
            cnt[i.second[j].second] += 2 - (j == 0) - (j == i.second.size() - 1);
        }
    }
    for (auto i : mp2) {
        sort(i.second.begin(), i.second.end());
        for (int j = 0; j < i.second.size(); j++) {
            cnt[i.second[j].second] += 2 - (j == 0) - (j == i.second.size() - 1);
        }
    }

    for (int i = 0; i < m; i++) out[cnt[i]]++;
    for (int i = 0; i < 9; i++) cout << out[i] << " ";

    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

template<class T> using OS = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ull unsigned long long

const int N = 1e5 + 5;
int cnt[N], n, m, x, y, out[10];
vector<vector<int>> V(N), H(N);
map<int, vector<pair<pair<int, int>, int>>> mp, mp2;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        V[x].push_back(i);
        H[y].push_back(i);
        mp[y - x].push_back({{x, y}, i});
        mp2[x + y].push_back({{x, y}, i});
    }

    for (int i = 0; i < N; i++) {
        sort(V[i].begin(), V[i].end());
        sort(H[i].begin(), H[i].end());

        for (int j = 0; j < V[i].size() && V[i].size() != 1; j++) {
            cnt[V[i][j]] += 2 - (j == 0) - (j == V[i].size() - 1);
        }
        for (int j = 0; j < H[i].size() && H[i].size() != 1; j++) {
            cnt[H[i][j]] += 2 - (j == 0) - (j == H[i].size() - 1);
        }
    }

    for (auto i : mp) {
        sort(i.second.begin(), i.second.end());
        for (int j = 0; j < i.second.size(); j++) {
            cnt[i.second[j].second] += 2 - (j == 0) - (j == i.second.size() - 1);
        }
    }
    for (auto i : mp2) {
        sort(i.second.begin(), i.second.end());
        for (int j = 0; j < i.second.size(); j++) {
            cnt[i.second[j].second] += 2 - (j == 0) - (j == i.second.size() - 1);
        }
    }

    for (int i = 0; i < m; i++) out[cnt[i]]++;
    for (int i = 0; i < 9; i++) cout << out[i] << " ";

    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define loop(i,n) for(int i=0 ; i<n ; i++)
#define rep(i,x,n) for(int i=x ; i<=n ; i++)
#define lp_over(i,x) for(auto i:x)
#define pr pair<int,int>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
        tree_order_statistics_node_update>;
const ll N=3e5 + 5 , MOD=1e9 + 7 , OO=2e9;
pr rows[N],cols[N],diag[N],diag2[N],queens[N];
int ans[9];
int n,m;
int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt", "rt", stdin);
#endif
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin>>n>>m;
    loop(i,m){
        int x,y;
        cin>>x>>y;
        queens[i]={x,y};
        if(rows[x].first==0)rows[x].first=y;

        rows[x].first=min(rows[x].first,y);
        rows[x].second=max(rows[x].second,y);

        if(cols[y].first==0)cols[y].first=x;
        cols[y].first=min(cols[y].first,x);
        cols[y].second=max(cols[y].second,x);

        int d=x-y + n;
        if(diag[d].first==0)diag[d].first=x;
        diag[d].first=min(diag[d].first,x);
        diag[d].second=max(diag[d].second,x);

        int col2=n-y+1;
        int d2=x-col2 + n;
        if(diag2[d2].first==0)diag2[d2].first=x;
        diag2[d2].first=min(diag2[d2].first,x);
        diag2[d2].second=max(diag2[d2].second,x);
    }
    loop(i,m){
        int res=0;
        int x=queens[i].first;
        int y=queens[i].second;
        int d=x-y + n;
        if(rows[x].first < y)res++;
        if(rows[x].second > y)res++;
        if(cols[y].first < x)res++;
        if(cols[y].second > x)res++;
        if(diag[d].first < x)res++;
        if(diag[d].second > x)res++;

        int col2=n-y+1;
        int d2=x-col2 + n;

        if(diag2[d2].first < x)res++;
        if(diag2[d2].second > x)res++;

        ans[res]++;
    }
    loop(i,9){
        cout<<ans[i]<<" ";
    }
    cout<<endl;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define loop(i,n) for(int i=0 ; i<n ; i++)
#define rep(i,x,n) for(int i=x ; i<=n ; i++)
#define lp_over(i,x) for(auto i:x)
#define pr pair<int,int>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
        tree_order_statistics_node_update>;
const ll N=3e5 + 5 , MOD=1e9 + 7 , OO=2e9;
pr rows[N],cols[N],diag[N],diag2[N],queens[N];
int ans[9];
int n,m;
int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt", "rt", stdin);
#endif
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin>>n>>m;
    loop(i,m){
        int x,y;
        cin>>x>>y;
        queens[i]={x,y};
        if(rows[x].first==0)rows[x].first=y;

        rows[x].first=min(rows[x].first,y);
        rows[x].second=max(rows[x].second,y);

        if(cols[y].first==0)cols[y].first=x;
        cols[y].first=min(cols[y].first,x);
        cols[y].second=max(cols[y].second,x);

        int d=x-y + n;
        if(diag[d].first==0)diag[d].first=x;
        diag[d].first=min(diag[d].first,x);
        diag[d].second=max(diag[d].second,x);

        int col2=n-y+1;
        int d2=x-col2 + n;
        if(diag2[d2].first==0)diag2[d2].first=x;
        diag2[d2].first=min(diag2[d2].first,x);
        diag2[d2].second=max(diag2[d2].second,x);
    }
    loop(i,m){
        int res=0;
        int x=queens[i].first;
        int y=queens[i].second;
        int d=x-y + n;
        if(rows[x].first < y)res++;
        if(rows[x].second > y)res++;
        if(cols[y].first < x)res++;
        if(cols[y].second > x)res++;
        if(diag[d].first < x)res++;
        if(diag[d].second > x)res++;

        int col2=n-y+1;
        int d2=x-col2 + n;

        if(diag2[d2].first < x)res++;
        if(diag2[d2].second > x)res++;

        ans[res]++;
    }
    loop(i,8){
        cout<<ans[i]<<" ";
    }
    cout<<endl;
}


#include <bits/stdc++.h>
#include <unordered_map>
#define R return
#define ll long long
#define ld long double
#define pb push_back
#define F first
#define S second
#define C continue
#define B break
#define PI acos(-1)
using namespace std;
ll fpow(ll x,ll y){
    if (y==0) R 1;
    if (y==1) R x;
    ll p =fpow(x,y/2);
    p*=p;
    if (y&1) p*=x;
    R p;
}
ll gcd(ll x,ll y){
    if (y==0) R x;
    R gcd(y,x%y);
}
int ans[10],r[200005],c[200005],mx[200005],mn[200005],mx1[200005],mn1[200005],mx2[200005],mn2[200005],mx3[200005],mn3[200005];
int fin(int a[],int b[],int x,int y){
    cout<<x<<' '<<y<<' '<<a[x]<<' '<<b[x]<<endl;
    if (a[x] == b[x]) R 0;
    if (y==a[x] || y==b[x]) R 1;
    R 2;
}
int main() {
    int n,m;
    scanf("%d%d",&n,&m);
    for (int i=1;i<=2*n;i++){
        mn[i] = mn1[i] = mn2[i] =mn3[i] = n+1;
    }
    for (int i=0;i<m;i++){
        scanf("%d%d",&r[i],&c[i]);
        mx[r[i]] = max(mx[r[i]],c[i]);
        mn[r[i]] = min(mn[r[i]],c[i]);
        mx1[c[i]] = max(mx1[c[i]],r[i]);
        mn1[c[i]] = min(mn1[c[i]],r[i]);
        mx2[c[i]+r[i]] = max(mx2[c[i]+r[i]],r[i]);
        mn2[c[i]+r[i]] = min(mn2[r[i]+c[i]],r[i]);
        mx3[r[i]-c[i]+n] = max(mx3[r[i]-c[i]+n],r[i]);
        mn3[r[i]-c[i]+n] = min(mn3[r[i]-c[i]+n],r[i]);
    }
    for (int i=0;i<m;i++){
        int u = r[i],v = c[i],x = u+v,y = u-v+n;
        int o = 0;
        o+= fin(mx,mn,u,v);
        o+= fin(mx1,mn1,v,u);
        o+= fin(mx2,mn2,x,u);
        o+= fin(mx3,mn3,y,u);
        ans[o]++;
    }
    for (int i=0;i<=8;i++){
        printf("%d ",ans[i]);
    }
    R 0;
}


#include <bits/stdc++.h>
#include <unordered_map>
#define R return
#define ll long long
#define ld long double
#define pb push_back
#define F first
#define S second
#define C continue
#define B break
#define PI acos(-1)
using namespace std;
ll fpow(ll x,ll y){
    if (y==0) R 1;
    if (y==1) R x;
    ll p =fpow(x,y/2);
    p*=p;
    if (y&1) p*=x;
    R p;
}
ll gcd(ll x,ll y){
    if (y==0) R x;
    R gcd(y,x%y);
}
int ans[10],r[200005],c[200005],mx[200005],mn[200005],mx1[200005],mn1[200005],mx2[200005],mn2[200005],mx3[200005],mn3[200005];
int fin(int a[],int b[],int x,int y){
    if (a[x] == b[x]) R 0;
    if (y==a[x] || y==b[x]) R 1;
    R 2;
}
int main() {
    int n,m;
    scanf("%d%d",&n,&m);
    for (int i=1;i<=2*n;i++){
        mn[i] = mn1[i] = mn2[i] =mn3[i] = n+1;
    }
    for (int i=0;i<m;i++){
        scanf("%d%d",&r[i],&c[i]);
        mx[r[i]] = max(mx[r[i]],c[i]);
        mn[r[i]] = min(mn[r[i]],c[i]);
        mx1[c[i]] = max(mx1[c[i]],r[i]);
        mn1[c[i]] = min(mn1[c[i]],r[i]);
        mx2[c[i]+r[i]] = max(mx2[c[i]+r[i]],r[i]);
        mn2[c[i]+r[i]] = min(mn2[r[i]+c[i]],r[i]);
        mx3[r[i]-c[i]+n] = max(mx3[r[i]-c[i]+n],r[i]);
        mn3[r[i]-c[i]+n] = min(mn3[r[i]-c[i]+n],r[i]);
    }
    for (int i=0;i<m;i++){
        int u = r[i],v = c[i],x = u+v,y = u-v+n;
        int o = 0;
        o+= fin(mx,mn,u,v);
        o+= fin(mx1,mn1,v,u);
        o+= fin(mx2,mn2,x,u);
        o+= fin(mx3,mn3,y,u);
        ans[o]++;
    }
    for (int i=0;i<=8;i++){
        printf("%d ",ans[i]);
    }
    R 0;
}


#include <bits/stdc++.h>
#include <unordered_map>
#define R return
#define ll long long
#define ld long double
#define pb push_back
#define F first
#define S second
#define C continue
#define B break
#define PI acos(-1)
using namespace std;
ll fpow(ll x,ll y){
    if (y==0) R 1;
    if (y==1) R x;
    ll p =fpow(x,y/2);
    p*=p;
    if (y&1) p*=x;
    R p;
}
ll gcd(ll x,ll y){
    if (y==0) R x;
    R gcd(y,x%y);
}
int ans[10],r[100005],c[100005];
set <int> ro[100005],co[100005],di[200005],di2[200005];
int fin(int ind,set <int> s,int x){
    int u = x;
    int u1 = *(s.rbegin());
    int u2 = *(s.begin());
    int y = 0;
    if (u!=u1) y++;
    if (u!=u2) y++;
    R y;
}
int main() {
    int n,m;
    scanf("%d%d",&n,&m);
    for (int i=0;i<m;i++){
        scanf("%d%d",&r[i],&c[i]);
        ro[r[i]].insert(c[i]);
        co[c[i]].insert(r[i]);
        di[r[i]+c[i]].insert(r[i]);
        int u = r[i] - c[i] + n;
        di2[u].insert(r[i]);
    }
    for (int i=0;i<m;i++){
        int x = 0;
        x += fin(i,ro[r[i]],c[i]);
        x += fin(i,co[c[i]],r[i]);
        x += fin(i,di[r[i]+c[i]],r[i]);
        x += fin(i,di2[r[i]-c[i]+n],r[i]);
        ans[x]++;
    }
    for (int i=0;i<=8;i++){
        printf("%d ",ans[i]);
    }
    R 0;
}


#include <bits/stdc++.h>
#include <unordered_map>
#define R return
#define ll long long
#define ld long double
#define pb push_back
#define F first
#define S second
#define C continue
#define B break
#define PI acos(-1)
using namespace std;
ll fpow(ll x,ll y){
    if (y==0) R 1;
    if (y==1) R x;
    ll p =fpow(x,y/2);
    p*=p;
    if (y&1) p*=x;
    R p;
}
ll gcd(ll x,ll y){
    if (y==0) R x;
    R gcd(y,x%y);
}
int ans[10],r[100005],c[100005];
set <int> ro[100005],co[100005],di[200005],di2[200005];
int fin(int ind,set <int> s,int x){
    auto it = s.lower_bound(x);
    int u = *it;
    int u1 = *(s.rbegin());
    int u2 = *(s.begin());
    int y = 0;
    if (u != u1) y++;
    if (u != u2) y++;
    R y;
}
int main() {
    int n,m;
    cin>>n>>m;
    for (int i=0;i<m;i++){
        cin>>r[i]>>c[i];
        ro[r[i]].insert(c[i]);
        co[c[i]].insert(r[i]);
        di[r[i]+c[i]].insert(r[i]);
        int u = r[i] - c[i] + n;
        di2[u].insert(r[i]);
    }
    for (int i=0;i<m;i++){
        int x = 0;
        x += fin(i,ro[r[i]],c[i]);
        x += fin(i,co[c[i]],r[i]);
        x += fin(i,di[r[i]+c[i]],r[i]);
        x += fin(i,di2[r[i]-c[i]+n],r[i]);
        ans[x]++;
    }
    for (int i=0;i<=8;i++){
        cout<<ans[i]<<' ';
    }
    R 0;
}


#include <bits/stdc++.h>
#include <unordered_map>
#define R return
#define ll long long
#define ld long double
#define pb push_back
#define F first
#define S second
#define C continue
#define B break
#define PI acos(-1)
using namespace std;
ll fpow(ll x,ll y){
    if (y==0) R 1;
    if (y==1) R x;
    ll p =fpow(x,y/2);
    p*=p;
    if (y&1) p*=x;
    R p;
}
ll gcd(ll x,ll y){
    if (y==0) R x;
    R gcd(y,x%y);
}
int ans[10],r[100005],c[100005];
set <int> ro[100005],co[100005],di[200005],di2[200005];
int fin(int ind,set <int> s,int x){
    auto it = s.lower_bound(x);
    int u = *it;
    int u1 = *(s.rbegin());
    int u2 = *(s.begin());
    int y = 0;
    if (u != u1) y++;
    if (u != u2) y++;
    R y;
}
int main() {
    int n,m;
    scanf("%d%d",&n,&m);
    for (int i=0;i<m;i++){
        scanf("%d%d",&r[i],&c[i]);
        ro[r[i]].insert(c[i]);
        co[c[i]].insert(r[i]);
        di[r[i]+c[i]].insert(r[i]);
        int u = r[i] - c[i] + n;
        di2[u].insert(r[i]);
    }
    for (int i=0;i<m;i++){
        int x = 0;
        x += fin(i,ro[r[i]],c[i]);
        x += fin(i,co[c[i]],r[i]);
        x += fin(i,di[r[i]+c[i]],r[i]);
        x += fin(i,di2[r[i]-c[i]+n],r[i]);
        ans[x]++;
    }
    for (int i=0;i<=8;i++){
        cout<<ans[i]<<' ';
    }
    R 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<vector<long long>> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pair<int,int>> vii;
typedef vector<pair<long long,long long>> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
const int INF = INT_MAX;
const ll LL_INF = LLONG_MAX;
#define pb push_back
#define LOOP(x, a, b) for(int x = a; x < b; ++ x)
#define LOOPD(x, a, b) for(int x = a; x >= b; -- x)
#define mp make_pair
#define fi first
#define se second

void print_vector(vi& v){
	for(int i:v)cout<<i<<" ";
	cout<<'\n';
}
void print_array(int a[],int s,int e){
	LOOP(i,s,e)cout<<a[i]<<" ";
	cout<<'\n';
}
int lc(int n){return n<<1;}
int rc(int n){return (n<<1)+1;}
int avg(int a, int b){return (a+b)/2;}

const int MAXN = 100005;
vii A[6*MAXN];
int P[MAXN][2];
int n,m;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T;
	//cin>>T;
	T = 1;
	while(T--){
		cin>>n>>m;
		LOOP(i,1,m+1){
			cin>>P[i][0]>>P[i][1];
		}
		LOOP(i,1,m+1){
			A[P[i][0]].pb(mp(P[i][1],i));
			A[n+P[i][1]].pb(mp(P[i][0],i));
			A[2*n+P[i][0]+P[i][1]-1].pb(mp(P[i][0],i));
			A[4*n-1+n+(P[i][0]-P[i][1])].pb(mp(P[i][0],i));
		}
		vi res(m,0);
		LOOP(i,1,6*n-1){
			sort(A[i].begin(),A[i].end());
			LOOP(j,0,A[i].size()){
				if(j-1>=0)res[A[i][j].se-1]++;
				if(j+1<A[i].size())res[A[i][j].se-1]++;
			}
		}
		vi ans(9,0);
		for(int i:res)ans[i]++;
		print_vector(ans);
	}
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vl;
typedef vector<vector<long long>> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pair<int,int>> vii;
typedef vector<pair<long long,long long>> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
const int INF = INT_MAX;
const ll LL_INF = LLONG_MAX;
#define pb push_back
#define LOOP(x, a, b) for(int x = a; x < b; ++ x)
#define LOOPD(x, a, b) for(int x = a; x >= b; -- x)
#define mp make_pair
#define fi first
#define se second

void print_vector(vi& v){
	for(int i:v)cout<<i<<" ";
	cout<<'\n';
}
void print_array(int a[],int s,int e){
	LOOP(i,s,e)cout<<a[i]<<" ";
	cout<<'\n';
}
int lc(int n){return n<<1;}
int rc(int n){return (n<<1)+1;}
int avg(int a, int b){return (a+b)/2;}

const int MAXN = 100005;
vii A[6*MAXN];
int P[MAXN][2];
int n,m;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T;
	//cin>>T;
	T = 1;
	while(T--){
		cin>>n>>m;
		LOOP(i,1,m+1){
			cin>>P[i][0]>>P[i][1];
		}
		LOOP(i,1,m+1){
			A[P[i][0]].pb(mp(P[i][1],i));
			A[n+P[i][1]].pb(mp(P[i][0],i));
			A[2*n+P[i][0]+P[i][1]-1].pb(mp(P[i][0],i));
			A[4*n-1+n+(P[i][0]-P[i][1])].pb(mp(P[i][0],i));
		}
		vi res(m,0);
		LOOP(i,1,6*n-1){
			sort(A[i].begin(),A[i].end());
			LOOP(j,0,A[i].size()){
				if(j-1>=0)res[A[i][j].se-1]++;
				if(j+1<A[i].size())res[A[i][j].se-1]++;
			}
		}
		vi ans(8,0);
		for(int i:res)ans[i]++;
		print_vector(ans);
	}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 1000005
#define M 1000000007

//Prime Numbers

vector<bool>prime(N+1,true);
void sieve()
{
	ll i,j,k;
	prime[0]=prime[1]=false;
	for(i=2;i*i<=N;i++)
	{
		if(prime[i])
		{
			for(j=i*i;j<=N;j++)
			{
				prime[j]=false;
			}
		}
	}
}

//Exponentiation

ll power(ll a,ll b)
{
	ll r=1;
	while(b)
	{
		if(b%2==1)
			r=r*a;
		b/=2;
		a*=a;
	}
	return r;
}
ll power(ll a,ll b,ll m)
{
	a=a%m;
	ll r=1;
	while(b)
	{
		if(b%2==1)
			r=(r*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return r;
}

//Prime Factors

vector<ll> factors(ll n)
{
	vector<ll>r;
	ll i,j;
	for(i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			r.push_back(i);
			if(n/i!=i)
				r.push_back(n/i);
		}
	}
	return r;
}

//GCD
ll gcd(ll a,ll b)
{
	if(b>a)
	{
		ll t=a;
		a=b;
		b=t;
	}
	if(b==0)return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
	return (a*b)/gcd(a,b);
}
//Graphs
vector<bool>bvisited(N,false);
vector<ll> bfs(ll V,vector<vector<ll>>G,ll s)
{
	vector<ll>order;
	queue<ll>q;
	bvisited[s]=true;
	q.push(s);
	while(!q.empty())
	{
		s=q.front();
		order.push_back(s);
		for(auto x:G[s])
		{
			if(!bvisited[x])
			{
				bvisited[x]=true;
				q.push(x);
			}
		}
	}
	return order;
}
vector<bool>dvisited(N,false);
vector<ll> dfs(ll V,vector<vector<ll>>G,ll s)
{
	vector<ll>order;
	stack<ll>q;
	q.push(s);
	while(!q.empty())
	{
		ll v=q.top();
		q.pop();
		if(!dvisited[v])
		{
			order.push_back(v);
			dvisited[v]=true;
		}
		for(ll i=0;i<G[v].size();i++)
		{
			if(!dvisited[G[v][i]])
			{
				q.push(G[v][i]);
			}
		}
	}
	return order;
}

//Main Solution

void solve()
{
    ll n,m,i,j,k,l;
    cin>>n>>m;
    vector<vector<pair<ll,ll>>>a(2*n),b(2*n);
    vector<vector<ll>>c(n),d(n);
    vector<ll>ans(9,0);
    vector<pair<ll,ll>>e;
    for(i=0;i<m;i++)
    {
        cin>>j>>k;
        j--;
        k--;
        e.push_back({j,k});
        l=j+k;
        a[l].push_back({j,k});
        l=abs(j-k);
        b[l].push_back({j,k});
        c[j].push_back(k);
        d[k].push_back(j);
    }
    for(auto x:e)
    {
        l=0;
        j=x.first;
        k=x.second;
        if(c[j][0]!=k)  l++;
        if(c[j].back()!=k) l++;
        if(d[k][0]!=j)  l++;
        if(d[k].back()!=j) l++;
        if(a[j+k][0]!=x) l++;
        if(a[j+k].back()!=x)l++;
        if(b[abs(j-k)][0]!=x)l++;
        if(b[abs(j-k)].back()!=x)l++;
        ans[l]++;
    }
    for(auto x:ans)
        cout<<x<<" ";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    ll t=1;
    while(t--)
    {
        solve();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 1000005
#define M 1000000007

//Prime Numbers

vector<bool>prime(N+1,true);
void sieve()
{
	ll i,j,k;
	prime[0]=prime[1]=false;
	for(i=2;i*i<=N;i++)
	{
		if(prime[i])
		{
			for(j=i*i;j<=N;j++)
			{
				prime[j]=false;
			}
		}
	}
}

//Exponentiation

ll power(ll a,ll b)
{
	ll r=1;
	while(b)
	{
		if(b%2==1)
			r=r*a;
		b/=2;
		a*=a;
	}
	return r;
}
ll power(ll a,ll b,ll m)
{
	a=a%m;
	ll r=1;
	while(b)
	{
		if(b%2==1)
			r=(r*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return r;
}

//Prime Factors

vector<ll> factors(ll n)
{
	vector<ll>r;
	ll i,j;
	for(i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			r.push_back(i);
			if(n/i!=i)
				r.push_back(n/i);
		}
	}
	return r;
}

//GCD
ll gcd(ll a,ll b)
{
	if(b>a)
	{
		ll t=a;
		a=b;
		b=t;
	}
	if(b==0)return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
	return (a*b)/gcd(a,b);
}
//Graphs
vector<bool>bvisited(N,false);
vector<ll> bfs(ll V,vector<vector<ll>>G,ll s)
{
	vector<ll>order;
	queue<ll>q;
	bvisited[s]=true;
	q.push(s);
	while(!q.empty())
	{
		s=q.front();
		order.push_back(s);
		for(auto x:G[s])
		{
			if(!bvisited[x])
			{
				bvisited[x]=true;
				q.push(x);
			}
		}
	}
	return order;
}
vector<bool>dvisited(N,false);
vector<ll> dfs(ll V,vector<vector<ll>>G,ll s)
{
	vector<ll>order;
	stack<ll>q;
	q.push(s);
	while(!q.empty())
	{
		ll v=q.top();
		q.pop();
		if(!dvisited[v])
		{
			order.push_back(v);
			dvisited[v]=true;
		}
		for(ll i=0;i<G[v].size();i++)
		{
			if(!dvisited[G[v][i]])
			{
				q.push(G[v][i]);
			}
		}
	}
	return order;
}

//Main Solution

void solve()
{
    ll n,m,i,j,k,l;
    cin>>n>>m;
    vector<vector<pair<ll,ll>>>a(2*n),b(2*n);
    vector<vector<ll>>c(n),d(n);
    vector<ll>ans(9,0);
    vector<pair<ll,ll>>e;
    for(i=0;i<m;i++)
    {
        cin>>j>>k;
        j--;
        k--;
        e.push_back({j,k});
        l=j+k;
        a[l].push_back({j,k});
        l=j-k+n;
        b[l].push_back({j,k});
        c[j].push_back(k);
        d[k].push_back(j);
    }
    for(i=0;i<a.size();i++)
    {
        sort(a[i].begin(),a[i].end());
        sort(b[i].begin(),b[i].end());
    }
    for(i=0;i<n;i++)
    {
        sort(c[i].begin(),c[i].end());
        sort(d[i].begin(),d[i].end());
    }
    for(auto x:e)
    {
        l=0;
        j=x.first;
        k=x.second;
        if(c[j][0]!=k)  l++;
        if(c[j].back()!=k) l++;
        if(d[k][0]!=j)  l++;
        if(d[k].back()!=j) l++;
        if(a[j+k][0]!=x) l++;
        if(a[j+k].back()!=x)l++;
        if(b[n+(j-k)][0]!=x)l++;
        if(b[n+(j-k)].back()!=x)l++;
        /*cout<<"\n"<<a[j+k][0].first<<","<<a[j+k][0].second;
        cout<<"\n"<<a[j+k].back().first<<","<<a[j+k].back().second;
        cout<<"\n"<<a[abs(j-k)][0].first<<","<<a[abs(j-k)][0].second;
        cout<<"\n"<<a[abs(j-k)].back().first<<","<<a[abs(j-k)].back().second<<"\n";
        cout<<x.first<<","<<x.second<<":"<<l<<"\n";*/
        ans[l]++;
    }
    for(auto x:ans)
        cout<<x<<" ";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    ll t=1;
    while(t--)
    {
        solve();
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 1000005
#define M 1000000007

//Prime Numbers

vector<bool>prime(N+1,true);
void sieve()
{
	ll i,j,k;
	prime[0]=prime[1]=false;
	for(i=2;i*i<=N;i++)
	{
		if(prime[i])
		{
			for(j=i*i;j<=N;j++)
			{
				prime[j]=false;
			}
		}
	}
}

//Exponentiation

ll power(ll a,ll b)
{
	ll r=1;
	while(b)
	{
		if(b%2==1)
			r=r*a;
		b/=2;
		a*=a;
	}
	return r;
}
ll power(ll a,ll b,ll m)
{
	a=a%m;
	ll r=1;
	while(b)
	{
		if(b%2==1)
			r=(r*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return r;
}

//Prime Factors

vector<ll> factors(ll n)
{
	vector<ll>r;
	ll i,j;
	for(i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			r.push_back(i);
			if(n/i!=i)
				r.push_back(n/i);
		}
	}
	return r;
}

//GCD
ll gcd(ll a,ll b)
{
	if(b>a)
	{
		ll t=a;
		a=b;
		b=t;
	}
	if(b==0)return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
	return (a*b)/gcd(a,b);
}
//Graphs
vector<bool>bvisited(N,false);
vector<ll> bfs(ll V,vector<vector<ll>>G,ll s)
{
	vector<ll>order;
	queue<ll>q;
	bvisited[s]=true;
	q.push(s);
	while(!q.empty())
	{
		s=q.front();
		order.push_back(s);
		for(auto x:G[s])
		{
			if(!bvisited[x])
			{
				bvisited[x]=true;
				q.push(x);
			}
		}
	}
	return order;
}
vector<bool>dvisited(N,false);
vector<ll> dfs(ll V,vector<vector<ll>>G,ll s)
{
	vector<ll>order;
	stack<ll>q;
	q.push(s);
	while(!q.empty())
	{
		ll v=q.top();
		q.pop();
		if(!dvisited[v])
		{
			order.push_back(v);
			dvisited[v]=true;
		}
		for(ll i=0;i<G[v].size();i++)
		{
			if(!dvisited[G[v][i]])
			{
				q.push(G[v][i]);
			}
		}
	}
	return order;
}

//Main Solution

void solve()
{
    ll n,m,i,j,k,l;
    cin>>n>>m;
    vector<vector<pair<ll,ll>>>a(2*n),b(2*n);
    vector<vector<ll>>c(n),d(n);
    vector<ll>ans(9,0);
    vector<pair<ll,ll>>e;
    for(i=0;i<m;i++)
    {
        cin>>j>>k;
        j--;
        k--;
        e.push_back({j,k});
        l=j+k;
        a[l].push_back({j,k});
        l=abs(j-k);
        b[l].push_back({j,k});
        c[j].push_back(k);
        d[k].push_back(j);
    }
    for(i=0;i<a.size();i++)
    {
        sort(a[i].begin(),a[i].end());
        sort(b[i].begin(),b[i].end());
    }
    for(auto x:e)
    {
        l=0;
        j=x.first;
        k=x.second;
        if(c[j][0]!=k)  l++;
        if(c[j].back()!=k) l++;
        if(d[k][0]!=j)  l++;
        if(d[k].back()!=j) l++;
        if(a[j+k][0]!=x) l++;
        if(a[j+k].back()!=x)l++;
        if(b[abs(j-k)][0]!=x)l++;
        if(b[abs(j-k)].back()!=x)l++;
        ans[l]++;
    }
    for(auto x:ans)
        cout<<x<<" ";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    ll t=1;
    while(t--)
    {
        solve();
    }
}


/*input
10 3
1 1
1 2
1 3
*/
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
const ll sz=2e5+2;
ll n,m;
ll r,c;
ll rcnt[sz],ccnt[sz],ld[sz],rd[sz];
ll mn[4][sz];
ll mx[4][sz];
ll ans[9],temp;
vector <pair<ll,ll>> pts;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    for(int i=0;i<9;i++) ans[i]=0;
    for(int i=1;i<=sz;i++) {
        for(int j=0;j<4;j++) mn[j][i]=1e18,mx[j][i]=-1;
    }
    for(int i=0;i<m;i++){
        cin>>r>>c; pts.push_back({r,c});
        rcnt[r]++; mx[0][r]=max(mx[0][r],c); mn[0][r]=min(mn[0][r],c);
        ccnt[c]++; mx[1][c]=max(mx[1][c],r); mn[1][c]=min(mn[1][c],r);
        rd[r+c]++; mx[2][r+c]=max(mx[2][r+c],r); mn[2][r+c]=min(mn[2][r+c],r);
        ld[n-c+1+r]++; mx[3][n-c+1+r]=max(mx[3][n-c+1+r],r); mn[3][n-c+1+r]=min(mn[3][n-c+1+r],r);
    }
    for(auto it:pts){
        temp=0;
        r=it.first;
        c=it.second;
        //cout<<r+c<<" "<<rd[r+c]<<endl;
        if(rcnt[r]>1){
            if(c==mx[0][r]||c==mn[0][r]) temp++;
            else temp+=2;
        }
        if(ccnt[c]>1){
            if(r==mx[1][c]||r==mn[1][c]) temp++;
            else temp+=2;
        }
        if(rd[r+c]>1){
            if(r==mx[2][r+c]||r==mn[2][r+c]) temp++;
            else temp+=2;
        }
        if(ld[n-c+1+r]>1){
            if(r==mx[3][n-c+1+r]||r==mn[3][n-c+1+r]) temp++;
            else temp+=2;
        }
        ans[temp]++;
        //cout<<r<<" "<<c<<" "<<temp<<endl;
    }
    ans[0]++;
    for(int i=0;i<9;i++) cout<<ans[i]<<" ";
    return 0;
}


/*input
10 3
1 1
1 2
1 3
*/
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
const ll sz=2e5+2;
ll n,m;
ll r,c;
ll rcnt[sz],ccnt[sz],ld[sz],rd[sz];
ll mn[4][sz];
ll mx[4][sz];
ll ans[9],temp;
vector <pair<ll,ll>> pts;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    for(int i=0;i<9;i++) ans[i]=0;
    for(int i=1;i<sz;i++) {
        for(int j=0;j<4;j++) mn[j][i]=1e18,mx[j][i]=-1;
    }
    for(int i=0;i<m;i++){
        cin>>r>>c; pts.push_back({r,c});
        rcnt[r]++; mx[0][r]=max(mx[0][r],c); mn[0][r]=min(mn[0][r],c);
        ccnt[c]++; mx[1][c]=max(mx[1][c],r); mn[1][c]=min(mn[1][c],r);
        rd[r+c]++; mx[2][r+c]=max(mx[2][r+c],r); mn[2][r+c]=min(mn[2][r+c],r);
        ld[n-c+1+r]++; mx[3][n-c+1+r]=max(mx[3][n-c+1+r],r); mn[3][n-c+1+r]=min(mn[3][n-c+1+r],r);
    }
    for(auto it:pts){
        temp=0;
        r=it.first;
        c=it.second;
        //cout<<r+c<<" "<<rd[r+c]<<endl;
        if(rcnt[r]>1){
            if(c==mx[0][r]||c==mn[0][r]) temp++;
            else temp+=2;
        }
        if(ccnt[c]>1){
            if(r==mx[1][c]||r==mn[1][c]) temp++;
            else temp+=2;
        }
        if(rd[r+c]>1){
            if(r==mx[2][r+c]||r==mn[2][r+c]) temp++;
            else temp+=2;
        }
        if(ld[n-c+1+r]>1){
            if(r==mx[3][n-c+1+r]||r==mn[3][n-c+1+r]) temp++;
            else temp+=2;
        }
        ans[temp]++;
        //cout<<r<<" "<<c<<" "<<temp<<endl;
    }
    ans[0]++;
    for(int i=0;i<9;i++) cout<<ans[i]<<" ";
    return 0;
}


/*input
10 3
1 1
1 2
1 3
*/
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
const ll sz=2e5+2;
ll n,m;
ll r,c;
ll rcnt[sz],ccnt[sz],ld[sz],rd[sz];
ll mn[4][sz];
ll mx[4][sz];
ll ans[9],temp;
vector <pair<ll,ll>> pts;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    for(int i=0;i<9;i++) ans[i]=0;
    for(int i=1;i<sz;i++) {
        for(int j=0;j<4;j++) mn[j][i]=1e18,mx[j][i]=-1;
    }
    for(int i=0;i<m;i++){
        cin>>r>>c; pts.push_back({r,c});
        rcnt[r]++; mx[0][r]=max(mx[0][r],c); mn[0][r]=min(mn[0][r],c);
        ccnt[c]++; mx[1][c]=max(mx[1][c],r); mn[1][c]=min(mn[1][c],r);
        rd[r+c]++; mx[2][r+c]=max(mx[2][r+c],r); mn[2][r+c]=min(mn[2][r+c],r);
        ld[n-c+1+r]++; mx[3][n-c+1+r]=max(mx[3][n-c+1+r],r); mn[3][n-c+1+r]=min(mn[3][n-c+1+r],r);
    }
    for(auto it:pts){
        temp=0;
        r=it.first;
        c=it.second;
        //cout<<r+c<<" "<<rd[r+c]<<endl;
        if(rcnt[r]>1){
            if(c==mx[0][r]||c==mn[0][r]) temp++;
            else temp+=2;
        }
        if(ccnt[c]>1){
            if(r==mx[1][c]||r==mn[1][c]) temp++;
            else temp+=2;
        }
        if(rd[r+c]>1){
            if(r==mx[2][r+c]||r==mn[2][r+c]) temp++;
            else temp+=2;
        }
        if(ld[n-c+1+r]>1){
            if(r==mx[3][n-c+1+r]||r==mn[3][n-c+1+r]) temp++;
            else temp+=2;
        }
        ans[temp]++;
        //cout<<r<<" "<<c<<" "<<temp<<endl;
    }
    //ans[0]++;
    for(int i=0;i<9;i++) cout<<ans[i]<<" ";
    return 0;
}


#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

const int N = 200500;

//bool ok[1005][1005];

int d1min[N], d1max[N];
int d2min[N], d2max[N];
int rowmin[N], rowmax[N];
int colmin[N], colmax[N];
int n, m, x[N], y[N], ans[9];

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	//cout << setprecision(10) << fixed;

	cin >> n >> m;

	/*cout << endl;

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++)
			cout << i + j - 1 << " ";
		cout << endl;
	}
	cout << endl;

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++)
			cout << n - i + j << " ";
		cout << endl;
	}
	cout << endl;*/

	for (int i = 1; i <= n + n - 1; i++)
		rowmin[i] = colmin[i] = d1min[i] = d2min[i] = N;

	for (int i = 1; i <= m; i++) {
		cin >> x[i] >> y[i];
		assert(!ok[x[i]][y[i]]);
		ok[x[i]][y[i]] = 1;
		rowmin[x[i]] = min(rowmin[x[i]], y[i]);
		rowmax[x[i]] = max(rowmax[x[i]], y[i]);
		colmin[y[i]] = min(colmin[y[i]], x[i]);
		colmax[y[i]] = max(colmax[y[i]], x[i]);
		d1min[x[i] + y[i] - 1] = min(d1min[x[i] + y[i] - 1], y[i]);
		d1max[x[i] + y[i] - 1] = max(d1max[x[i] + y[i] - 1], y[i]);
		d2min[n - x[i] + y[i]] = min(d2min[n - x[i] + y[i]], y[i]);
		d2max[n - x[i] + y[i]] = max(d2max[n - x[i] + y[i]], y[i]);
	}

	/*for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++)
			cout << ok[i][j] << " ";
		cout << endl;
	}
	cout << endl;*/

	for (int i = 1; i <= m; i++) {
		int cnt = 0;
		cnt += rowmin[x[i]] < y[i];
		cnt += rowmax[x[i]] > y[i];
		cnt += colmin[y[i]] < x[i];
		cnt += colmax[y[i]] > x[i];
		cnt += d1min[x[i] + y[i] - 1] < y[i];
		cnt += d1max[x[i] + y[i] - 1] > y[i];
		cnt += d2min[n - x[i] + y[i]] < y[i];
		cnt += d2max[n - x[i] + y[i]] > y[i];
		//cout << x[i] << " " << y[i] << " : " << cnt << endl;
		ans[cnt]++;
	}
	//cout << endl;

	for (int i = 0; i <= 8; i++)
		cout << ans[i] << " ";

	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

const int N = 200500;

//bool ok[1005][1005];

int d1min[N], d1max[N];
int d2min[N], d2max[N];
int rowmin[N], rowmax[N];
int colmin[N], colmax[N];
int n, m, x[N], y[N], ans[9];

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	//cout << setprecision(10) << fixed;

	cin >> n >> m;

	/*cout << endl;

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++)
			cout << i + j - 1 << " ";
		cout << endl;
	}
	cout << endl;

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++)
			cout << n - i + j << " ";
		cout << endl;
	}
	cout << endl;*/

	for (int i = 1; i <= n + n - 1; i++)
		rowmin[i] = colmin[i] = d1min[i] = d2min[i] = N;

	for (int i = 1; i <= m; i++) {
		cin >> x[i] >> y[i];
		//assert(!ok[x[i]][y[i]]);
		//ok[x[i]][y[i]] = 1;
		rowmin[x[i]] = min(rowmin[x[i]], y[i]);
		rowmax[x[i]] = max(rowmax[x[i]], y[i]);
		colmin[y[i]] = min(colmin[y[i]], x[i]);
		colmax[y[i]] = max(colmax[y[i]], x[i]);
		d1min[x[i] + y[i] - 1] = min(d1min[x[i] + y[i] - 1], y[i]);
		d1max[x[i] + y[i] - 1] = max(d1max[x[i] + y[i] - 1], y[i]);
		d2min[n - x[i] + y[i]] = min(d2min[n - x[i] + y[i]], y[i]);
		d2max[n - x[i] + y[i]] = max(d2max[n - x[i] + y[i]], y[i]);
	}

	/*for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++)
			cout << ok[i][j] << " ";
		cout << endl;
	}
	cout << endl;*/

	for (int i = 1; i <= m; i++) {
		int cnt = 0;
		cnt += rowmin[x[i]] < y[i];
		cnt += rowmax[x[i]] > y[i];
		cnt += colmin[y[i]] < x[i];
		cnt += colmax[y[i]] > x[i];
		cnt += d1min[x[i] + y[i] - 1] < y[i];
		cnt += d1max[x[i] + y[i] - 1] > y[i];
		cnt += d2min[n - x[i] + y[i]] < y[i];
		cnt += d2max[n - x[i] + y[i]] > y[i];
		//cout << x[i] << " " << y[i] << " : " << cnt << endl;
		ans[cnt]++;
	}
	//cout << endl;

	for (int i = 0; i <= 8; i++)
		cout << ans[i] << " ";

	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define mst(x,i) memset(x, i, sizeof(x))
#define X first
#define Y second
#define dbg(a) cout << #a": " << a << endl;
typedef long long LL;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;
const double dinf = inf;
using namespace std;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ull,ull> puu;

const int maxn = 1e5+10;
const double eps = 1e-10;

struct P
{
    int x,y;
    int id;
    P(int x,int y,int id): x(x),y(y),id(id){}
};

vector<P> c[maxn],r[maxn],lx[maxn*2],rx[maxn*2];
int n,m;
int cot[maxn];

bool cmp1(const P& A, const P& B) { return A.y<B.y; }
bool cmp2(const P& A, const P& B) { return A.x<B.y; }

int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif // LOCAL
    scanf("%d%d",&n,&m);
    int x,y;
    rep(i, m){
        scanf("%d%d",&x,&y);
        P t(x,y,i);
        r[x].push_back(t);
        c[y].push_back(t);
        lx[x-y+n].push_back(t);
        rx[x+y].push_back(t);
    }
    mst(cot, 0);
    for(int i=1; i<=n; i++) if(r[i].size()>1){
        int num = r[i].size();
        sort(r[i].begin(), r[i].end(), cmp1);
        rep(j, num){
            if(j==0 || j==num-1) cot[r[i][j].id]++;
            else cot[r[i][j].id] += 2;
        }
    }
    for(int i=1; i<=n; i++) if(c[i].size()>1){
        int num = c[i].size();
        sort(c[i].begin(), c[i].end(), cmp2);
        rep(j, num){
            if(j==0 || j==num-1) cot[c[i][j].id]++;
            else cot[c[i][j].id] += 2;
        }
    }
    for(int i=1; i<=n*2-1; i++) if(lx[i].size()>1){
        int num = lx[i].size();
        sort(lx[i].begin(), lx[i].end(), cmp1);
        rep(j, num){
            if(j==0 || j==num-1) cot[lx[i][j].id]++;
            else cot[lx[i][j].id] += 2;
        }
    }
    for(int i=1; i<=n*2-1; i++) if(rx[i].size()>1){
        int num = rx[i].size();
        sort(rx[i].begin(), rx[i].end(), cmp1);
        rep(j, num){
            if(j==0 || j==num-1) cot[rx[i][j].id]++;
            else cot[rx[i][j].id] += 2;
        }
    }
    int t[10];
    mst(t, 0);
    rep(i, m){
        t[cot[i]]++;
    }
    rep(i, 9) printf("%d%c",t[i], i<9? ' ': '\n');

    return 0;
}


#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define mst(x,i) memset(x, i, sizeof(x))
#define X first
#define Y second
#define dbg(a) cout << #a": " << a << endl;
typedef long long LL;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;
const double dinf = inf;
using namespace std;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ull,ull> puu;

const int maxn = 1e5+10;
const double eps = 1e-10;

struct P
{
    int x,y;
    int id;
    P(int x,int y,int id): x(x),y(y),id(id){}
};

vector<P> c[maxn],r[maxn],lx[maxn*2],rx[maxn*2];
int n,m;
int cot[maxn];

bool cmp1(const P& A, const P& B) { return A.y<B.y; }
bool cmp2(const P& A, const P& B) { return A.x<B.x; }

int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif // LOCAL
    scanf("%d%d",&n,&m);
    int x,y;
    rep(i, m){
        scanf("%d%d",&x,&y);
        P t(x,y,i);
        r[x].push_back(t);
        c[y].push_back(t);
        lx[x-y+n].push_back(t);
        rx[x+y].push_back(t);
    }
    mst(cot, 0);
    for(int i=1; i<=n; i++) if(r[i].size()>1){
        int num = r[i].size();
        sort(r[i].begin(), r[i].end(), cmp1);
        rep(j, num){
            if(j==0 || j==num-1) cot[r[i][j].id]++;
            else cot[r[i][j].id] += 2;
        }
    }
    for(int i=1; i<=n; i++) if(c[i].size()>1){
        int num = c[i].size();
        sort(c[i].begin(), c[i].end(), cmp2);
        rep(j, num){
            if(j==0 || j==num-1) cot[c[i][j].id]++;
            else cot[c[i][j].id] += 2;
        }
    }
    for(int i=1; i<=n*2; i++) if(lx[i].size()>1){
        int num = lx[i].size();
        sort(lx[i].begin(), lx[i].end(), cmp1);
        rep(j, num){
            if(j==0 || j==num-1) cot[lx[i][j].id]++;
            else cot[lx[i][j].id] += 2;
        }
    }
    for(int i=1; i<=n*2; i++) if(rx[i].size()>1){
        int num = rx[i].size();
        sort(rx[i].begin(), rx[i].end(), cmp1);
        rep(j, num){
            if(j==0 || j==num-1) cot[rx[i][j].id]++;
            else cot[rx[i][j].id] += 2;
        }
    }
    int t[10];
    mst(t, 0);
    rep(i, m){
        t[cot[i]]++;
    }
    rep(i, 9) printf("%d%c",t[i], i<9? ' ': '\n');

    return 0;
}


#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define mst(x,i) memset(x, i, sizeof(x))
#define X first
#define Y second
#define dbg(a) cout << #a": " << a << endl;
typedef long long LL;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;
const double dinf = inf;
using namespace std;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ull,ull> puu;

const int maxn = 1e5+10;
const double eps = 1e-10;

struct P
{
    int x,y;
    int id;
    P(int x,int y,int id): x(x),y(y),id(id){}
};

vector<P> c[maxn],r[maxn],lx[maxn*2],rx[maxn*2];
int n,m;
int cot[maxn];

bool cmp1(const P& A, const P& B) { return A.y<B.y; }
bool cmp2(const P& A, const P& B) { return A.x<B.y; }

int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif // LOCAL
    scanf("%d%d",&n,&m);
    int x,y;
    rep(i, m){
        scanf("%d%d",&x,&y);
        P t(x,y,i);
        r[x].push_back(t);
        c[y].push_back(t);
        lx[x-y+n].push_back(t);
        rx[x+y].push_back(t);
    }
    mst(cot, 0);
    for(int i=1; i<=n; i++) if(r[i].size()>1){
        int num = r[i].size();
        sort(r[i].begin(), r[i].end(), cmp1);
        rep(j, num){
            if(j==0 || j==num-1) cot[r[i][j].id]++;
            else cot[r[i][j].id] += 2;
        }
    }
    for(int i=1; i<=n; i++) if(c[i].size()>1){
        int num = c[i].size();
        sort(c[i].begin(), c[i].end(), cmp2);
        rep(j, num){
            if(j==0 || j==num-1) cot[c[i][j].id]++;
            else cot[c[i][j].id] += 2;
        }
    }
    for(int i=1; i<=n*2; i++) if(lx[i].size()>1){
        int num = lx[i].size();
        sort(lx[i].begin(), lx[i].end(), cmp1);
        rep(j, num){
            if(j==0 || j==num-1) cot[lx[i][j].id]++;
            else cot[lx[i][j].id] += 2;
        }
    }
    for(int i=1; i<=n*2; i++) if(rx[i].size()>1){
        int num = rx[i].size();
        sort(rx[i].begin(), rx[i].end(), cmp1);
        rep(j, num){
            if(j==0 || j==num-1) cot[rx[i][j].id]++;
            else cot[rx[i][j].id] += 2;
        }
    }
    int t[10];
    mst(t, 0);
    rep(i, m){
        t[cot[i]]++;
    }
    rep(i, 9) printf("%d%c",t[i], i<9? ' ': '\n');

    return 0;
}


#include <stdio.h>
#include <bits/stdc++.h>

#define pb push_back
#define pp pop_back
#define sz(a) (int)(a.size())
#define mp make_pair
#define F first
#define S second
#define next _next
#define prev _prev
#define left _left
#define right _right
#define y1 _y1
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = (int)1e5 + 123;
const ll INF = (ll)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;

int up[N], down[N], left[N], right[N];
int n, m;
int r[N], c[N];
pair<pii, int> p[N];
pair<pair<int, pii>, int> pp[N];
int lu[N], ru[N], ld[N], rd[N];
int res[N];

int main() {
	unsigned int FOR;
 	asm("rdtsc" : "=A"(FOR));
  	srand(FOR);
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= m; i ++) {
		scanf("%d%d", &r[i], &c[i]);
		p[i] = mp(mp(c[i], r[i]), i);
	}
	sort(p + 1, p + m + 1);
	for(int i = 1; i <= m; i ++) {
		if(i - 1 > 0 && p[i].F.F == p[i - 1].F.F && p[i - 1].F.S < p[i].F.S)
			up[p[i].S] = 1;
		if(i + 1 <= n && p[i].F.F == p[i + 1].F.F && p[i + 1].F.S > p[i].F.S)
			down[p[i].S] = 1;
	}
	for(int i = 1; i <= m; i ++) {
		p[i] = mp(mp(r[i], c[i]), i);
	}
	sort(p + 1, p + m + 1);
	for(int i = 1; i <= m; i ++) {
		if(i - 1 > 0 && p[i].F.F == p[i - 1].F.F && p[i - 1].F.S < p[i].F.S)
			left[p[i].S] = 1;
		if(i + 1 <= n && p[i].F.F == p[i + 1].F.F && p[i + 1].F.S > p[i].F.S)
			right[p[i].S] = 1;
	}

	for(int i = 1; i <= m; i ++) {
		pp[i] = mp(mp(r[i] + c[i], mp(r[i], c[i]) ), i);
	}
	sort(pp + 1, pp + m + 1);
	for(int i = 1; i <= m; i ++) {
		if(i - 1 > 0 && pp[i].F.F == pp[i - 1].F.F && pp[i - 1].F.S.F < pp[i].F.S.F)
			ru[pp[i].S] = 1;
		if(i + 1 <= n && pp[i].F.F == pp[i + 1].F.F && pp[i + 1].F.S.F > pp[i].F.S.F)
			ld[pp[i].S] = 1;
	}

	for(int i = 1; i <= m; i ++) {
		pp[i] = mp(mp(r[i] - c[i], mp(r[i], c[i])), i);
	}
	sort(pp + 1, pp + m + 1);
	for(int i = 1; i <= m; i ++) {
		if(i - 1 > 0 && pp[i].F.F == pp[i - 1].F.F && pp[i - 1].F.S.F < pp[i].F.S.F)
			lu[pp[i].S] = 1;
		if(i + 1 <= n && pp[i].F.F == pp[i + 1].F.F && pp[i + 1].F.S.F > pp[i].F.S.F)
			rd[pp[i].S] = 1;
	}
	for(int i = 1; i <= m; i ++) {
		//cout << "left: " << left[i] << " right: " << right[i] << " up: " << up[i] << " down: " << down[i] << " lu: " << lu[i] << " ru: " << ru[i] << " ld: " << ld[i] << " rd: " << rd[i] << "\n";
		res[left[i] + right[i] + up[i] + down[i] + lu[i] + ru[i] + ld[i] + rd[i]] ++;
	}
	for(int i = 0; i < 9; i ++)
		printf("%d ", res[i]);//cout << res[i] << " ";
	return 0;
}


#include <stdio.h>
#include <bits/stdc++.h>

#define pb push_back
#define pp pop_back
#define sz(a) (int)(a.size())
#define mp make_pair
#define F first
#define S second
#define next _next
#define prev _prev
#define left _left
#define right _right
#define y1 _y1
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = (int)1e5 + 123;
const ll INF = (ll)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;

int up[N], down[N], left[N], right[N];
int n, m;
int r[N], c[N];
pair<pii, int> p[N];
pair<pair<int, pii>, int> pp[N];
int lu[N], ru[N], ld[N], rd[N];
int res[N];

int main() {
	unsigned int FOR;
 	asm("rdtsc" : "=A"(FOR));
  	srand(FOR);
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= m; i ++) {
		scanf("%d%d", &r[i], &c[i]);
		p[i] = mp(mp(c[i], r[i]), i);
	}
	sort(p + 1, p + m + 1);
	for(int i = 1; i <= m; i ++) {
		if(i - 1 > 0 && p[i].F.F == p[i - 1].F.F && p[i - 1].F.S < p[i].F.S)
			up[p[i].S] = 1;
		if(i + 1 <= m && p[i].F.F == p[i + 1].F.F && p[i + 1].F.S > p[i].F.S)
			down[p[i].S] = 1;
	}
	for(int i = 1; i <= m; i ++) {
		p[i] = mp(mp(r[i], c[i]), i);
	}
	sort(p + 1, p + m + 1);
	for(int i = 1; i <= m; i ++) {
		if(i - 1 > 0 && p[i].F.F == p[i - 1].F.F && p[i - 1].F.S < p[i].F.S)
			left[p[i].S] = 1;
		if(i + 1 <= m && p[i].F.F == p[i + 1].F.F && p[i + 1].F.S > p[i].F.S)
			right[p[i].S] = 1;
	}

	for(int i = 1; i <= m; i ++) {
		pp[i] = mp(mp(r[i] + c[i], mp(r[i], c[i]) ), i);
	}
	sort(pp + 1, pp + m + 1);
	for(int i = 1; i <= m; i ++) {
		if(i - 1 > 0 && pp[i].F.F == pp[i - 1].F.F && pp[i - 1].F.S.F < pp[i].F.S.F)
			ru[pp[i].S] = 1;
		if(i + 1 <= m && pp[i].F.F == pp[i + 1].F.F && pp[i + 1].F.S.F > pp[i].F.S.F)
			ld[pp[i].S] = 1;
	}

	for(int i = 1; i <= m; i ++) {
		pp[i] = mp(mp(r[i] - c[i], mp(r[i], c[i])), i);
	}
	sort(pp + 1, pp + m + 1);
	for(int i = 1; i <= m; i ++) {
		if(i - 1 > 0 && pp[i].F.F == pp[i - 1].F.F && pp[i - 1].F.S.F < pp[i].F.S.F)
			lu[pp[i].S] = 1;
		if(i + 1 <= m && pp[i].F.F == pp[i + 1].F.F && pp[i + 1].F.S.F > pp[i].F.S.F)
			rd[pp[i].S] = 1;
	}
	for(int i = 1; i <= m; i ++) {
		//cout << "left: " << left[i] << " right: " << right[i] << " up: " << up[i] << " down: " << down[i] << " lu: " << lu[i] << " ru: " << ru[i] << " ld: " << ld[i] << " rd: " << rd[i] << "\n";
		res[left[i] + right[i] + up[i] + down[i] + lu[i] + ru[i] + ld[i] + rd[i]] ++;
	}
	for(int i = 0; i < 9; i ++)
		printf("%d ", res[i]);//cout << res[i] << " ";
	return 0;
}


#include <stdio.h>
#include <bits/stdc++.h>

#define pb push_back
#define pp pop_back
#define sz(a) (int)(a.size())
#define mp make_pair
#define F first
#define S second
#define next _next
#define prev _prev
#define left _left
#define right _right
#define y1 _y1
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = (int)1e5 + 123;
const ll INF = (ll)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;

int up[N], down[N], left[N], right[N];
int n, m;
int r[N], c[N];
pair<pii, int> p[N];
pair<pair<int, pii>, int> pp[N];
int lu[N], ru[N], ld[N], rd[N];
int res[N];

int main() {
	unsigned int FOR;
 	asm("rdtsc" : "=A"(FOR));
  	srand(FOR);
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= m; i ++) {
		scanf("%d%d", &r[i], &c[i]);
		p[i] = mp(mp(c[i], r[i]), i);
	}
	sort(p + 1, p + m + 1);
	for(int i = 1; i <= m; i ++) {
		if(p[i].F.F == p[i - 1].F.F && p[i - 1].F.S < p[i].F.S)
			up[p[i].S] = 1;
		if(p[i].F.F == p[i + 1].F.F && p[i + 1].F.S > p[i].F.S)
			down[p[i].S] = 1;
	}
	for(int i = 1; i <= m; i ++) {
		p[i] = mp(mp(r[i], c[i]), i);
	}
	sort(p + 1, p + m + 1);
	for(int i = 1; i <= m; i ++) {
		if(p[i].F.F == p[i - 1].F.F && p[i - 1].F.S < p[i].F.S)
			left[p[i].S] = 1;
		if(p[i].F.F == p[i + 1].F.F && p[i + 1].F.S > p[i].F.S)
			right[p[i].S] = 1;
	}

	for(int i = 1; i <= m; i ++) {
		pp[i] = mp(mp(r[i] + c[i], mp(r[i], c[i]) ), i);
	}
	sort(pp + 1, pp + m + 1);
	for(int i = 1; i <= m; i ++) {
		if(pp[i].F.F == pp[i - 1].F.F && pp[i - 1].F.S.F < pp[i].F.S.F)
			ru[pp[i].S] = 1;
		if(pp[i].F.F == pp[i + 1].F.F && pp[i + 1].F.S.F > pp[i].F.S.F)
			ld[pp[i].S] = 1;
	}

	for(int i = 1; i <= m; i ++) {
		pp[i] = mp(mp(r[i] - c[i], mp(r[i], c[i])), i);
	}
	sort(pp + 1, pp + m + 1);
	for(int i = 1; i <= m; i ++) {
		if(pp[i].F.F == pp[i - 1].F.F && pp[i - 1].F.S.F < pp[i].F.S.F)
			lu[pp[i].S] = 1;
		if(pp[i].F.F == pp[i + 1].F.F && pp[i + 1].F.S.F > pp[i].F.S.F)
			rd[pp[i].S] = 1;
	}
	for(int i = 1; i <= m; i ++) {
		res[left[i] + right[i] + up[i] + down[i] + lu[i] + ru[i] + ld[i] + rd[i]] ++;
	}
	for(int i = 0; i < 9; i ++)
		printf("%d ", res[i]);//cout << res[i] << " ";
	return 0;
}


/*
    author : pshishod2645
    Created at : 10:44:47 PM, 28 July 2020
*/

#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9 + 7;

typedef long long ll;
//#define int long long
#define cerr cout
#define sz(a) (int)((a).size())
#define all(x) (x).begin(), (x).end()
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
inline int add(int a, int b){a += b; if(a >= MOD)a -= MOD; return a;}
inline int sub(int a, int b){a -= b; if(a < 0)a += MOD; return a;}
inline int mul(int a, int b){return (int)((long long) a * b %MOD);}
inline int binpow(int a, int b){int res = 1; while(b > 0){ if(b & 1)res = mul(res, a); a = mul(a, a);b /= 2;} return res;}
inline int inv(int a){return binpow(a, MOD - 2);}
int gcd(int a, int b, int &x, int &y){if(a == 0){x = 0, y = 1; return b;} int x1, y1;  int d = gcd(b%a, a, x1, y1); x = y1 - (b/a) * x1; y = x1; return d;}

void process(vector<pair<int, int> > &pos, vector<int> &num){
    if(pos.empty())return;
    sort(all(pos));
    for(auto &i: pos)num[i.second] += 2;
    num[pos[0].second]--; num[pos.back().second]--;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n, m; cin>>n>>m;
    vector<pair<int, int> > horizontal[n], vertical[n], slantLeft[2*n], slantRight[2*n];
    vector<int> num(m), ans(9);

    for(int i = 0;i < m; ++i){
        int x, y; cin>>x>>y; x--; y--;
        horizontal[x].push_back({y, i});
        vertical[y].push_back({x, i});
        slantLeft[x + y].push_back({x, i});
        slantRight[x - y + n].push_back({x, i});
    }

    for(int i = 0;i < n; ++i)process(horizontal[i], num), process(vertical[i], num);
    for(int i = 0;i < 2*n; ++i)process(slantLeft[i], num), process(slantRight[i], num);

    for(int &x: num)ans[x]++;
    for(int &x: ans)cout<<x<<" "; cout<<"\n";

    return 0;
}


/*
    author : pshishod2645
    Created at : 10:44:47 PM, 28 July 2020
*/

#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9 + 7;

typedef long long ll;
//#define int long long
#define cerr cout
#define sz(a) (int)((a).size())
#define all(x) (x).begin(), (x).end()
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
inline int add(int a, int b){a += b; if(a >= MOD)a -= MOD; return a;}
inline int sub(int a, int b){a -= b; if(a < 0)a += MOD; return a;}
inline int mul(int a, int b){return (int)((long long) a * b %MOD);}
inline int binpow(int a, int b){int res = 1; while(b > 0){ if(b & 1)res = mul(res, a); a = mul(a, a);b /= 2;} return res;}
inline int inv(int a){return binpow(a, MOD - 2);}
int gcd(int a, int b, int &x, int &y){if(a == 0){x = 0, y = 1; return b;} int x1, y1;  int d = gcd(b%a, a, x1, y1); x = y1 - (b/a) * x1; y = x1; return d;}

void process(vector<int> &pos, vector<int> &num){
    if(pos.empty())return;
    for(int &i: pos)num[i] += 2;
    num[pos[0]]--; num[pos.back()]--;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n, m; cin>>n>>m;
    vector<int> horizontal[n], vertical[n], slantLeft[2*n], slantRight[2*n];
    vector<int> num(m), ans(9);

    for(int i = 0;i < m; ++i){
        int x, y; cin>>x>>y; x--; y--;
        horizontal[x].push_back(i);
        vertical[y].push_back(i);
        slantLeft[x + y].push_back(i);
        slantRight[x - y + n].push_back(i);
    }

    for(int i = 0;i < n; ++i)process(horizontal[i], num), process(vertical[i], num);
    for(int i = 0;i < 2*n; ++i)process(slantLeft[i], num), process(slantRight[i], num);

    for(int &x: num)ans[x]++;
    for(int &x: ans)cout<<x<<" "; cout<<"\n";

    return 0;
}


#include <iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<queue>
#include<stack>
#include<cmath>
using namespace std;

typedef long long ll;
#define ls rt<<1
#define rs rt<<1|1
const int maxn = 2e5 + 10;
const int maxm = 1e6 + 10;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3fLL;
const double eps=1e-7;
const int mod=1e9+7;

int x[maxn],y[maxn],c[maxn],r[maxn],lc[maxn],rc[maxn];
int t[10];
int main()
{
#ifdef local
    freopen("input.txt","r",stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m,bx,lx,by,ly,blc,llc,brc,lrc;
    cin>>n>>m;
    cin>>x[1]>>y[1];
    bx=lx=x[1];
    by=ly=y[1];
    blc=llc=x[1]+y[1];
    brc=lrc=x[1]-y[1];
    c[x[1]]++; r[y[1]]++; lc[x[1]+y[1]]++; rc[x[1]-y[1]+n]++;
    for(int i=2;i<=m;i++) {
        cin>>x[i]>>y[i];
        c[x[i]]++; r[y[i]]++;
        lc[x[i]+y[i]]++; rc[x[i]-y[i]+n]++;
        bx=max(bx,y[i]);
        lx=min(lx,y[i]);

        by=max(by,x[i]);
        ly=min(ly,x[i]);

        blc=max(blc,x[i]);
        llc=max(llc,x[i]);

        brc=max(brc,x[i]);
        lrc=max(lrc,x[i]);
    }
    for(int i=1;i<=m;i++) {
        int ans=0;
        if(c[x[i]]==2) ans++;
        if(c[x[i]]>2) {
            if(y[i]==bx||y[i]==lx) ans++;
            else ans+=2;
        }

        if(r[y[i]]==2) ans++;
        if(r[y[i]]>2) {
            if(x[i]==by||x[i]==ly) ans++;
            else ans+=2;
        }

        if(lc[x[i]+y[i]]==2) ans++;
        if(lc[x[i]+y[i]]>2) {
            if(x[i]==blc||x[i]==llc) ans++;
            else ans+=2;
        }

        if(rc[x[i]-y[i]+n]==2) ans++;
        if(rc[x[i]-y[i]+n]>2) {
            if(x[i]==brc||x[i]==lrc) ans++;
            else ans+=2;
        }
        t[ans]++;
    }
    for(int i=0;i<8;i++) cout<<t[i]<<' ';
    cout<<t[8]<<endl;
    return 0;
}