http://codeforces.com/problemset/problem/701/B
#include<stdio.h>
#include<string>
#include<cstring>
#include<queue>
#include<algorithm>
#include<functional>
#include<vector>
#include<iomanip>
#include<math.h>
#include<iostream>
#include<sstream>
#include<stack>
#include<set>
#include<bitset>
using namespace std;
const int MAX=100005;
bool r[MAX],c[MAX];
long long n,m,x,y,R,C;
long long Ans[MAX];
int main()
{
cin.sync_with_stdio(false);
while (cin>>n>>m)
{
Ans[0]=n*n;
memset(r,0,sizeof(r));
memset(c,0,sizeof(c));
R=n,C=n;
for (int i=1; i<=m; i++)
{
cin>>x>>y;
if (r[x]&&c[y])
{
Ans[i]=Ans[i-1];
}
else if (c[y])
{
Ans[i]=Ans[i-1]-R;
r[x]=true;
C--;
}
else if (r[x])
{
Ans[i]=Ans[i-1]-C;
c[y]=true;
R--;
}
else
{
Ans[i]=Ans[i-1]-R-C+1;
R--;
C--;
r[x]=true;
c[y]=true;
}
}
for (int i=1; i<=m-1; i++)
{
cout<<Ans[i]<<' ';
}
cout<<Ans[m]<<'\n';
}
return 0;
}