Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.

The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook located in the cell, this cell is also under attack.

You are given the positions of the board where Vasya will put rooks. For each rook you have to determine the number of cells which are not under attack after Vasya puts it on the board.


-----Input-----

The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n^2)) — the size of the board and the number of rooks. 

Each of the next m lines contains integers x_{i} and y_{i} (1 ≤ x_{i}, y_{i} ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya puts rooks on the board in the order they appear in the input. It is guaranteed that any cell will contain no more than one rook.


-----Output-----

Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put.


-----Examples-----
Input
3 3
1 1
3 1
2 2

Output
4 2 0 

Input
5 2
1 5
5 1

Output
16 9 

Input
100000 1
300 400

Output
9999800001 



-----Note-----

On the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack.

 [Image]

Difficulty: EASY

Solutions:
from sys import stdin, stdout
(n, m) = map(int, stdin.readline().split())
nonOccup = n * n
ligOccupe = [False] * n
nbLigSup = 0
colOccupe = [False] * n
nbColSup = 0
for tour in range(m):
	(lig, col) = map(int, stdin.readline().split())
	lig -= 1
	col -= 1
	if not ligOccupe[lig]:
		nonOccup -= n - nbColSup
		ligOccupe[lig] = True
		nbLigSup += 1
	if not colOccupe[col]:
		nonOccup -= n - nbLigSup
		colOccupe[col] = True
		nbColSup += 1
	stdout.write(str(nonOccup) + ' ')


(n, m) = (int(x) for x in input().split())
noncovered = n * n
norow = {i for i in range(1, n + 1)}
nocol = {i for i in range(1, n + 1)}
answer = []
for i in range(m):
	(r, c) = (int(x) for x in input().split())
	if r in norow and c in nocol:
		noncovered -= len(norow) + len(nocol) - 1
		norow.remove(r)
		nocol.remove(c)
	elif r in norow:
		noncovered -= len(nocol)
		norow.remove(r)
	elif c in nocol:
		noncovered -= len(norow)
		nocol.remove(c)
	answer.append(str(noncovered))
print(' '.join(answer))


(n, m) = map(int, input().split())
row = dict()
col = dict()
ans = []
for i in range(m):
	(x, y) = map(int, input().split())
	row[x] = row.get(x, 0) + 1
	col[y] = col.get(y, 0) + 1
	a = len(row)
	b = len(col)
	ans.append(n * n - (n * a + n * b - a * b))
print(' '.join(map(str, ans)))


(n, m) = map(int, input().split())
dx = set({})
dy = set({})
t1 = 0
for i in range(m):
	(x, y) = map(int, input().split())
	dx.add(x)
	dy.add(y)
	t1 = max(0, n - len(dx)) * max(0, n - len(dy))
	print(t1, end=' ')


import sys
(n, m) = map(int, sys.stdin.readline().split())
xset = set()
yset = set()
ans = []
for _ in range(m):
	(x, y) = map(int, sys.stdin.readline().split())
	xset.add(x)
	yset.add(y)
	ans.append(str((n - len(xset)) * (n - len(yset))))
print(' '.join(ans))


def main():
	(n, m) = map(int, input().split())
	r = [0 for _ in range(n)]
	c = [0 for _ in range(n)]
	(R, C) = (0, 0)
	now = n * n
	for i in range(m):
		(x, y) = map(int, input().split())
		x -= 1
		y -= 1
		if r[y] == 0 and c[x] == 0:
			r[y] = 1
			c[x] = 1
			now -= n - R + (n - C) - 1
			R += 1
			C += 1
		elif r[y] == 0:
			r[y] = 1
			now -= n - C
			R += 1
		elif c[x] == 0:
			c[x] = 1
			now -= n - R
			C += 1
		if i > 0:
			print(' ', end='')
		print(now, end='')
	print()
main()


I = lambda : map(int, input().split())
(n, m) = I()
(row, column) = ({}, {})
for i in range(m):
	(r, c) = I()
	(row[r], column[c]) = (1, 1)
	(len_row, len_column) = (len(row), len(column))
	attacked = (len_row + len_column) * n - len_row * len_column
	print(n * n - attacked, end=' ')


import sys
(n, m) = map(int, sys.stdin.readline().split())
horiz = list([0] * n)
vert = list([0] * n)
res = [0] * m
full = n * n
hCount = 0
vCount = 0
for i in range(m):
	(x, y) = map(int, sys.stdin.readline().split())
	if horiz[x - 1] != 1:
		horiz[x - 1] = 1
		hCount += 1
	if vert[y - 1] != 1:
		vert[y - 1] = 1
		vCount += 1
	res[i] = full - n * (hCount + vCount) + hCount * vCount
for i in range(m):
	sys.stdout.write(str(res[i]) + ' ')


(n, m) = map(int, input().split())
row = set()
col = set()
for _ in range(1, m + 1):
	(x, y) = map(int, input().split())
	row.add(x)
	col.add(y)
	print((n - len(row)) * (n - len(col)), end=' ')


x = input()
(n, m) = list(map(int, x.strip().split()))
vseh_polj = n ** 2
vrstice = set()
stolpci = set()
vrni = []
for _ in range(m):
	u = input()
	(x, y) = list(map(int, u.strip().split()))
	(x, y) = (x - 1, y - 1)
	vrstice.add(x)
	stolpci.add(y)
	vrni.append(str(vseh_polj - n * len(vrstice) - len(stolpci) * (n - len(vrstice))))
print(' '.join(vrni))


inp = input().strip().split()
boardS = int(inp[0])
lines = int(inp[1])
rows = []
cols = []
for i in range(100001):
	rows.append(0)
	cols.append(0)
rowN = 0
colN = 0
rook = [0, 0]
out = boardS * boardS
outs = []
for i in range(lines):
	line = input().strip().split()
	line[0] = int(line[0])
	line[1] = int(line[1])
	if rows[line[0]] != 1:
		rowN += 1
		rows[line[0]] = 1
		out = out - (boardS - colN)
	if cols[line[1]] != 1:
		colN += 1
		cols[line[1]] = 1
		out = out - (boardS - rowN)
	outs.append(out)
for i in outs:
	print(str(i), end=' ')


r = dict()
c = dict()
ans = []
(n, m) = (int(z) for z in input().split())
ans.append(n * n)
for i in range(m):
	(x, y) = (int(z) for z in input().split())
	if x in r and y in c:
		pl = 0
		r[x] += 1
		c[y] += 1
	elif x in r:
		pl = n - len(r)
		r[x] += 1
		c[y] = 1
	elif y in c:
		pl = n - len(c)
		c[y] += 1
		r[x] = 1
	else:
		pl = 2 * n - 1 - len(c) - len(r)
		c[y] = 1
		r[x] = 1
	ans.append(ans[-1] - pl)
print(' '.join(map(str, ans[1:])))


(n, m) = map(int, input().split())
res = [n ** 2]
(rows, cols) = (set(), set())
for i in range(m):
	(x, y) = map(int, input().split())
	temp = res[-1]
	if x not in rows:
		temp -= n - len(cols)
		rows.add(x)
	if y not in cols:
		temp -= n - len(rows)
		cols.add(y)
	res.append(temp)
print(*res[1:])


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))
(n, m) = map(int, input().split())
temp = m
tot = n * n
ans = []
col = {}
row = {}
firsttime = 1
while temp:
	temp -= 1
	(x, y) = map(int, input().split())
	if x in row and y in col:
		ans.append(tot)
	elif x in row and y not in col:
		tot -= n - len(row)
		if tot > 0:
			ans.append(tot)
		else:
			ans.append(0)
		col[y] = 1
	elif y in col and x not in row:
		tot -= n - len(col)
		if tot > 0:
			ans.append(tot)
		else:
			ans.append(0)
		row[x] = 1
	else:
		if firsttime:
			tot -= n + n - 1
			firsttime = 0
		else:
			tot -= n - len(col)
			tot -= n - len(row)
			tot += 1
		if tot > 0:
			ans.append(tot)
		else:
			ans.append(0)
		row[x] = 1
		col[y] = 1
print(*ans)


(n, m) = map(int, input().split())
(x, y, s) = (set(), set(), '')
for i in range(m):
	(a, b) = map(int, input().split())
	x.add(a)
	y.add(b)
	s += str((n - len(x)) * (n - len(y))) + ' '
print(s)


inf = list(map(int, input().split()))
(n, m) = (inf[0], inf[1])
row = [0] * (n + 9)
col = [0] * (n + 9)
r = c = 0
ans = []
for i in range(m):
	inf = list(map(int, input().split()))
	(x, y) = (inf[0], inf[1])
	if row[x] == 0:
		row[x] = 1
		r += 1
	if col[y] == 0:
		col[y] = 1
		c += 1
	ans.append((n - r) * (n - c))
ans = ' '.join(map(str, ans))
print(ans)


N = list(map(int, input().split()))
n = N[0]
x = set()
y = set()
xl = 0
yl = 0
for i in range(N[1]):
	count = n * n
	(X, Y) = map(int, input().split())
	x.add(X)
	y.add(Y)
	count = count - len(x) * n
	if count != 0:
		count = count - len(y) * (n - len(x))
	print(count, end=' ')


(n, m) = map(int, input().split())
col = [False for i in range(n + 1)]
row = [False for i in range(n + 1)]
ncol = nrow = 0
nsq = n * n
for i in range(m):
	(r, c) = map(int, input().split())
	if not col[c]:
		col[c] = True
		ncol += 1
	if not row[r]:
		row[r] = True
		nrow += 1
	print(nsq - (ncol + nrow) * n + ncol * nrow, end=' ')
print('')


(n, m) = [int(i) for i in input().split()]
v = [0] * (n + 1)
h = [0] * (n + 1)
p_v = 0
p_h = 0
prev = 0
for i in range(m):
	(x, y) = [int(j) for j in input().split()]
	if h[x] == 0 and v[y] == 0:
		print(int(n * n - prev - (2 * n - 1 - (p_v + p_h))), end=' ')
		prev += 2 * n - 1 - (p_v + p_h)
		h[x] = 1
		v[y] = 1
		p_v += 1
		p_h += 1
	elif h[x] == 1 and v[y] == 0:
		print(int(n * n - prev - (n - p_h)), end=' ')
		prev += n - p_h
		v[y] = 1
		p_v += 1
	elif v[y] == 1 and h[x] == 0:
		print(int(n * n - prev - (n - p_v)), end=' ')
		prev += n - p_v
		h[x] = 1
		p_h += 1
	else:
		print(int(n * n - prev), end=' ')


(n, m) = map(int, input().split())
res = []
i_deleted = set()
j_deleted = set()
total = n * n
for r in range(m):
	(i, j) = input().split()
	aux = 0
	i_not_deleted = i not in i_deleted
	j_not_deleted = j not in j_deleted
	if i_not_deleted:
		aux += n - len(j_deleted)
	if j_not_deleted:
		aux += n - len(i_deleted)
	if i_not_deleted and j_not_deleted:
		aux -= 1
	i_deleted.add(i)
	j_deleted.add(j)
	total -= aux
	res.append(str(total))
print(' '.join(res))


from collections import *
dx = defaultdict(int)
dy = defaultdict(int)
(n, m) = map(int, input().split())
for i in range(m):
	(x, y) = map(int, input().split())
	dx[x] = dy[y] = 1
	print((n - len(dx)) * (n - len(dy)), end=' ')


(n, m) = [int(i) for i in input().strip().split()]
r_atk = set()
c_atk = set()
for __ in range(m):
	(r, c) = [int(i) for i in input().strip().split()]
	if r not in r_atk:
		r_atk.add(r)
	if c not in c_atk:
		c_atk.add(c)
	print((n - len(r_atk)) * (n - len(c_atk)), end=' ')


(n, m) = map(int, input().split())
row = set()
col = set()
s = ''
for i in range(m):
	(r, c) = map(int, input().split())
	row.add(r)
	col.add(c)
	dead = len(row) * n + len(col) * (n - len(row))
	s += str(n * n - dead) + ' '
print(s)


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import add
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
(n, k) = r()
row = defaultdict(lambda : 0)
col = defaultdict(lambda : 0)
x = y = n
for _ in range(k):
	(a, b) = r()
	if not col[b]:
		col[b] = 1
		y -= 1
	if not row[a]:
		row[a] = 1
		x -= 1
	print(x * y, end=' ')


def g():
	return list(map(int, input().split()))
(n, m) = g()
a = [True] * n
b = [True] * n
(c, d) = (0, 0)
res = n ** 2
for i in range(m):
	(e, f) = g()
	e -= 1
	f -= 1
	res -= a[e] * (n - c)
	d += a[e]
	a[e] = False
	res -= b[f] * (n - d)
	c += b[f]
	b[f] = False
	print(res, end=' ')


(n, r) = map(int, input().split())
xset = set()
yset = set()
res = 0
rres = []
ycarry = 0
xcarry = 0
for i in range(r):
	(x, y) = map(int, input().split())
	if x not in xset and y not in yset:
		res = res + n * 2 - 1 - ycarry - xcarry
		xcarry += 1
		ycarry += 1
		xset.add(x)
		yset.add(y)
	elif x not in xset:
		res = res + n - xcarry
		xset.add(x)
		ycarry += 1
	elif y not in yset:
		res = res + n - ycarry
		yset.add(y)
		xcarry += 1
	rres.append(n * n - res)
print(' '.join(map(str, rres)))


(n, m) = (int(i) for i in input().split())
r = {}
c = {}
s = n * n
(x, y) = (int(i) for i in input().split())
r[x] = 1
c[y] = 1
s1 = 1
s2 = 1
s -= 2 * n - 1
l = [s]
for i in range(m - 1):
	(x, y) = (int(i) for i in input().split())
	if x not in r:
		r[x] = 1
		s -= n - s2
		s1 += 1
	if y not in c:
		c[y] = 1
		s -= n - s1
		s2 += 1
	l.append(s)
print(*l)


(n, m) = list(map(int, input().split()))
count = n * n
counts = [None] * m
row = col = n
row_pos = [False] * n
col_pos = [False] * n
for i in range(m):
	(cur_row, cur_col) = list(map(int, input().split()))
	cur_row -= 1
	cur_col -= 1
	if not row_pos[cur_row] and (not col_pos[cur_col]):
		row_pos[cur_row] = col_pos[cur_col] = True
		row -= 1
		col -= 1
		count -= row + col + 1
	elif not row_pos[cur_row]:
		row_pos[cur_row] = True
		row -= 1
		count -= col
	elif not col_pos[cur_col]:
		col_pos[cur_col] = True
		col -= 1
		count -= row
	counts[i] = count
print(' '.join(list(map(str, counts))))


(n, m) = input().split()
n = int(n)
m = int(m)
rows = set()
cols = set()
for i in range(m):
	(row, col) = input().split()
	row = int(row)
	col = int(col)
	rows.add(row)
	cols.add(col)
	result = n * n - n * (len(rows) + len(cols)) + len(rows) * len(cols)
	print(result, end=' ')


(n, m) = map(int, input().split())
xax = [False] * n
yax = [False] * n
result = ''
x_count = 0
y_count = 0
for i in range(1, m + 1):
	(x, y) = map(int, input().split())
	x_count += 1
	y_count += 1
	if xax[x - 1] == True:
		x_count -= 1
	if yax[y - 1] == True:
		y_count -= 1
	xax[x - 1] = True
	yax[y - 1] = True
	count = n * n
	count -= n * x_count + n * y_count - x_count * y_count
	result += str(count) + ' '
print(result)


(n, m) = map(int, input().split())
x_mark = [0 for _ in range(0, n + 1)]
y_mark = [0 for _ in range(0, n + 1)]
(x_r, y_r) = (n, n)
for i in range(0, m):
	(x, y) = map(int, input().split())
	if x_mark[x] == 0:
		x_mark[x] = 1
		x_r -= 1
	if y_mark[y] == 0:
		y_mark[y] = 1
		y_r -= 1
	print(y_r * x_r, end=' ')


(n, m) = map(int, input().split())
a = []
for i in range(m):
	g = list(map(int, input().split()))
	a.append(g)
ans = []
r = [0] * (n + 1)
c = [0] * (n + 1)
row = n
col = n
for i in range(m):
	if r[a[i][0]] == 0:
		row -= 1
		r[a[i][0]] += 1
	if c[a[i][1]] == 0:
		col -= 1
		c[a[i][1]] += 1
	ans.append(row * col)
for i in range(m):
	print(ans[i], end=' ')


(n, m) = map(int, input().split())
dangerl = [0] * (n + 1)
dangerc = [0] * (n + 1)
safel = n
safec = n
out = []
for e in range(m):
	(l, c) = map(int, input().split())
	if dangerl[l] == 0:
		dangerl[l] = 1
		safel -= 1
	if dangerc[c] == 0:
		dangerc[c] = 1
		safec -= 1
	out.append(safel * safec)
for i in out:
	print(i, end=' ')


(n, m) = [int(i) for i in input().split()]
rows = set()
cols = set()
res = [0] * m
for i in range(m):
	(x, y) = [int(i) for i in input().split()]
	rows.add(x)
	cols.add(y)
	res[i] = (n - len(rows)) * (n - len(cols))
print(' '.join((str(r) for r in res)))


(n, m) = map(int, input().split(' '))
(row, col) = ([0] * n, [0] * n)
(numrow, numcol) = (n, n)
result = [0] * m
for i in range(m):
	(x, y) = map(lambda t: int(t) - 1, input().split(' '))
	if row[x] == 0:
		row[x] = 1
		numrow -= 1
	if col[y] == 0:
		col[y] = 1
		numcol -= 1
	result[i] = numrow * numcol
print(' '.join(map(str, result)))


s = input().split()
n = int(s[0])
m = int(s[1])
d = [[int(c) for c in input().split()] for i in range(m)]
res = n * n
a = n
b = n
x = []
y = []
for i in range(n):
	x.append(0)
for i in range(n):
	y.append(0)
for i in range(m):
	if x[d[i][0] - 1] == 0 and y[d[i][1] - 1] == 0:
		res -= a + b - 1
		a -= 1
		b -= 1
		x[d[i][0] - 1] = 1
		y[d[i][1] - 1] = 1
		print(res, end=' ')
	elif x[d[i][0] - 1] == 1 and y[d[i][1] - 1] == 0:
		res -= a
		b -= 1
		y[d[i][1] - 1] = 1
		print(res, end=' ')
	elif x[d[i][0] - 1] == 0 and y[d[i][1] - 1] == 1:
		res -= b
		a -= 1
		x[d[i][0] - 1] = 1
		print(res, end=' ')
	else:
		res -= 0
		print(res, end=' ')


(n, m) = map(int, input().split())
res = n * n
row = [0] * (n + 1)
col = [0] * (n + 1)
c = 0
r = 0
for i in range(m):
	(x, y) = map(int, input().split())
	if row[x] == 0:
		row[x] = 1
		r += 1
	if col[y] == 0:
		col[y] = 1
		c += 1
	print(res - (r * n + c * (n - r)), end=' ')


tempInput = input()
tempArr = tempInput.split()
tableSize = int(tempArr[0])
pointCount = int(tempArr[1])
rowSet = set()
columnSet = set()
resultArr = []
index = 0
while index < pointCount:
	locationStr = input()
	locationArr = locationStr.split()
	rowSet.add(locationArr[0])
	columnSet.add(locationArr[1])
	remaindCell = (tableSize - len(columnSet)) * (tableSize - len(rowSet))
	resultArr.append(str(remaindCell))
	index += 1
resultStr = ' '.join(resultArr)
print(resultStr)


import sys
row = set()
col = set()
tmp = [int(x) for x in sys.stdin.readline().split()]
(n, m) = (tmp[0], tmp[1])
for i in range(m):
	tmp = [int(x) for x in sys.stdin.readline().split()]
	(x, y) = (tmp[0], tmp[1])
	row.add(x)
	col.add(y)
	underAttack = (len(row) + len(col)) * n - len(row) * len(col)
	print(n * n - underAttack, end=' ')


def get_line():
	return list(map(int, input().split()))
(n, m) = get_line()
total = n ** 2
rows = set()
cols = set()
ans = []
for _ in range(m):
	(r, c) = get_line()
	rows.add(r)
	cols.add(c)
	n_rows = len(rows)
	remain = total - n * n_rows - (n - n_rows) * len(cols)
	ans.append(str(remain))
print(' '.join(ans))


import math
import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
(R, C) = (set(), set())
ans = []
for _ in range(m):
	(r, c) = map(int, input().split())
	R.add(r)
	C.add(c)
	bad = n * (len(R) + len(C)) - len(R) * len(C)
	ans.append(str(n * n - bad))
print(' '.join(ans))


import sys
(n, m) = map(int, input().split())
lines = sys.stdin.readlines()
row = set()
col = set()
r = n * n
for i in lines:
	(x, y) = map(int, i.split())
	if x not in row and y not in col:
		row.add(x)
		col.add(y)
		r = max(0, r - n + len(row) - n + len(col) - 1)
	elif x in row and y not in col:
		col.add(y)
		r = max(0, r - (n - len(row)))
	elif y in col and x not in row:
		row.add(x)
		r = max(0, r - (n - len(col)))
	print(r, '', end='')


(n, m) = map(int, input().split())
unbeaten = n * n
rows = set()
columns = set()
for i in range(m):
	(x, y) = map(int, input().split())
	newX = bool(x not in rows)
	newY = bool(y not in columns)
	if newX:
		unbeaten -= n - 1 - len(columns) + (1 if not newY else 0)
	if newY:
		unbeaten -= n - 1 - len(rows) + (1 if not newX else 0)
	if newX and newY:
		unbeaten -= 1
	print(unbeaten, end=' ')
	rows.add(x)
	columns.add(y)


(s, rooks) = map(int, input().split())
(columns, rows) = ([0] * s, [0] * s)
(cN, cR) = (0, 0)
taken = 0
for i in range(rooks):
	(a, b) = map(int, input().split())
	if columns[a - 1] == 0:
		cN += 1
		taken += s - cR
		columns[a - 1] = 1
	if rows[b - 1] == 0:
		cR += 1
		taken += s - cN
		rows[b - 1] = 1
	print(s ** 2 - taken, end=' ')


(n, m) = map(int, input().split())
xs = [0 for i in range(n)]
ys = [0 for i in range(n)]
l = 0
k = 0
for i in range(m):
	(x, y) = map(int, input().split())
	if xs[x - 1] != 1:
		xs[x - 1] = 1
		l += 1
	if ys[y - 1] != 1:
		ys[y - 1] = 1
		k += 1
	print(n * n - (l + k) * n + l * k, end=' ')


(n, m) = map(int, input().split())
k = n ** 2
ki = []
cx = set()
cy = set()
a = [False] * n
b = [False] * n
x1 = y1 = -1
d = 0
for i in range(m):
	d = 0
	(x, y) = map(int, input().split())
	x -= 1
	y -= 1
	if a[x] == True and b[y] == True:
		ki.append(k)
		continue
	if a[x] == False:
		a[x] = True
		x1 += 1
		if b[y] == False:
			b[y] = True
			y1 += 1
			k -= 2 * n - 1 - x1 - y1
		else:
			k -= n - 1 - y1
	else:
		b[y] = True
		y1 += 1
		d += 1
		k -= n - 1 - x1
	ki.append(k)
print(*ki)


(n, m) = list(map(int, input().split()))
r = ''
colunas = set()
linhas = set()
total = n ** 2
for i in range(m):
	(l, c) = list(map(int, input().split()))
	linhas.add(l)
	colunas.add(c)
	count = len(linhas) * n + len(colunas) * n - len(linhas) * len(colunas)
	r += str(total - count) + ' '
print(r.rstrip())


import sys
r = set()
c = set()
n = int(sys.stdin.readline().split()[0])
l = sys.stdin.readline().split()
while l:
	(x, y) = l
	r.add(x)
	c.add(y)
	sys.stdout.write(str((n - len(r)) * (n - len(c))) + ' ')
	l = sys.stdin.readline().split()


(tamanho_tabuleiro, n_entradas) = map(int, input().split(' '))
resposta = []
linhas = set()
counas = set()
for i in range(n_entradas):
	(l, c) = map(int, input().split(' '))
	linhas.add(l)
	counas.add(c)
	tamanho = tamanho_tabuleiro * tamanho_tabuleiro
	tamanho -= tamanho_tabuleiro * len(linhas)
	tamanho -= (tamanho_tabuleiro - len(linhas)) * len(counas)
	resposta.append(str(tamanho))
print(' '.join(resposta))


def main():
	(n, m) = [int(x) for x in input().split()]
	set_x = set()
	set_y = set()
	for i in range(0, m):
		(x, y) = [int(k) for k in input().split()]
		set_x.add(x)
		set_y.add(y)
		set_x_size = len(set_x)
		set_y_size = len(set_y)
		res = n * n - set_x_size * n - set_y_size * n + set_x_size * set_y_size
		print(res, end=' ')
main()


n = input().split()
m = int(n[1])
n = int(n[0])
x = set()
y = set()
s = list()
e = 0
for i in range(0, m):
	t = input().split()
	x.add(int(t[0]))
	y.add(int(t[1]))
	num = (n - len(x)) * (n - len(y))
	if num < 0:
		e = i
		break
	s.append(str(num))
if e != 0:
	c = ['0' for l in range(e, m)]
	s.extend(c)
st = ' '
print(st.join(s))


read = lambda : list(map(int, input().split()))
(n, m) = read()
ans = [0] * m
dx = [0] * (n + 1)
dy = [0] * (n + 1)
cur = n ** 2
kx = ky = 0
for i in range(m):
	(x, y) = read()
	if dx[x] == 0 and dy[y] == 0:
		cur = cur - n - n + kx + ky + 1
		kx += 1
		ky += 1
		dx[x] = 1
		dy[y] = 1
	elif dx[x] == 0 and dy[y] == 1:
		cur = cur - n + ky
		kx += 1
		dx[x] = 1
	elif dx[x] == 1 and dy[y] == 0:
		cur = cur - n + kx
		ky += 1
		dy[y] = 1
	ans[i] = cur
print(*ans)


(xy, m) = map(int, input().split())
rows = [False] * xy
columns = [False] * xy
(r, c) = (0, 0)
answear = ''
cells = xy ** 2
space = False
for i in range(m):
	(x, y) = map(int, input().split())
	if space:
		answear += ' '
	space = True
	if rows[x - 1] == 0:
		rows[x - 1] = 1
		cells -= xy - c
		r += 1
	if columns[y - 1] == 0:
		columns[y - 1] = 1
		cells -= xy - r
		c += 1
	answear += str(cells)
print(answear)


(n, m) = map(int, input().split())
row = [0 for i in range(100001)]
r = 0
col = [0 for i in range(100001)]
c = 0
for i in range(m):
	(a, b) = map(int, input().split())
	if row[a] == 0:
		row[a] = 1
		r += 1
	if col[b] == 0:
		col[b] = 1
		c += 1
	ans = n * n - (r + c) * n + r * c
	print(ans, end=' ')


(N, M) = map(int, input().strip().split())
(cols, rows) = (set(), set())
for i in range(M):
	(x, y) = map(int, input().strip().split())
	cols.add(x)
	rows.add(y)
	amount = N * N - N * len(cols) - (N - len(cols)) * len(rows)
	print(amount, end=' ')
print()


(n, m) = list(map(int, input().split()))
xs = [0 for i in range(n + 1)]
ys = [0 for i in range(n + 1)]
(xsum, ysum) = (0, 0)
s = n * n
for i in range(m):
	(x, y) = list(map(int, input().split()))
	if not xs[x]:
		s -= n - 1
		s += ysum - ys[y]
	if not ys[y]:
		s -= n - 1
		s += xsum - xs[x]
	if not xs[x] and (not ys[y]):
		s -= 1
	if not xs[x]:
		xsum += 1
		xs[x] += 1
	if not ys[y]:
		ysum += 1
		ys[y] += 1
	print(s, end=' ')
print('')


(n, m) = map(int, input().split())
xm = [False] * n
ym = [False] * n
lym = 0
lxm = 0
ans = n * n
for i in range(m):
	(x, y) = map(lambda x: int(x) - 1, input().split())
	if not xm[x]:
		xm[x] = True
		ans -= n - lym
		lxm += 1
	if not ym[y]:
		ym[y] = True
		ans -= n - lxm
		lym += 1
	print(ans, end=' ')


(n, m) = map(int, input().split())
safe = n * n
ans = []
rows = set()
cols = set()
while m:
	m -= 1
	(x, y) = map(int, input().split())
	if x not in rows and y not in cols:
		safe -= n + n - len(rows) - len(cols) - 1
		rows.add(x)
		cols.add(y)
	if x in rows and y not in cols:
		safe -= n - len(rows)
		cols.add(y)
	if x not in rows and y in cols:
		safe -= n - len(cols)
		rows.add(x)
	ans.append(safe)
print(' '.join([str(a) for a in ans]))


from sys import stdin, stdout

def calculate_free(free_columns, free_rows):
	return len(free_columns) * len(free_rows)

def update_board(rook, free_columns, free_rows):
	column = rook[0]
	row = rook[1]
	if column in free_columns:
		del free_columns[column]
	if row in free_rows:
		del free_rows[row]

def solve(rooks, n):
	free_columns = {}
	free_rows = {}
	for i in range(1, n + 1):
		free_columns[i] = True
		free_rows[i] = True
	free_spaces = []
	for rook in rooks:
		update_board(rook, free_columns, free_rows)
		free_space = calculate_free(free_columns, free_rows)
		free_spaces.append(free_space)
		stdout.write(str(free_space))
		stdout.write(' ')
	return free_spaces
(n, m) = map(int, input().split())
rooks = []
for i in range(m):
	(a, b) = map(int, input().split())
	rooks.append((a, b))
solve(rooks, n)


(c, r) = ({}, {})
(n, k) = map(int, input().split())
ans = []
for i in range(k):
	(i, j) = map(int, input().split())
	(c[i], r[j]) = (1, 1)
	(li, lj) = (len(c), len(r))
	ans += [n * n - li * n - lj * n + li * lj]
print(*ans)


(n, m) = map(int, input().split())
(rows, columns) = (set(), set())
resp = ''
for i in range(m):
	num = n ** 2
	(row, column) = map(int, input().split())
	rows.add(row)
	columns.add(column)
	pre = len(rows) * n + len(columns) * n
	rep = len(rows) * len(columns)
	resp += str(num - (pre - rep)) + ' '
print(resp)


(n, m) = [int(i) for i in input().split()]
s = [[0, 0] for i in range(n)]
r = n ** 2
ans = []
q = 0
w = 0
for i in range(m):
	(a, b) = [int(y) for y in input().split()]
	if not s[a - 1][0]:
		q += 1
	if not s[b - 1][1]:
		w += 1
	s[a - 1][0] += 1
	s[b - 1][1] += 1
	ans.append(n ** 2 - q * n - w * n + q * w)
print(*ans)


import sys

def main():
	(size, n_rooks) = [int(x) for x in sys.stdin.readline().split()]
	rows_akd = set()
	cols_akd = set()
	for line in sys.stdin.readlines():
		(x, y) = line.split()
		rows_akd.add(x)
		cols_akd.add(y)
		safe = size ** 2
		safe -= len(rows_akd) * size
		safe -= len(cols_akd) * (size - len(rows_akd))
		print(safe, end=' ')
	print()
main()


A = input().split()
n = int(A[0])
m = int(A[1])
s = n ** 2
B = [0] * (n + 1)
C = [0] * (n + 1)
x1 = n
y1 = n
for i in range(m):
	A = input().split()
	x = int(A[0])
	y = int(A[1])
	if B[x] == 0 and C[y] == 0:
		s = s - x1 - y1 + 1
		x1 -= 1
		y1 -= 1
	if B[x] == 1 and C[y] == 0:
		s = s - y1
		x1 -= 1
	if B[x] == 0 and C[y] == 1:
		s = s - x1
		y1 -= 1
	B[x] = 1
	C[y] = 1
	print(s, end=' ')


l = [int(x) for x in input().split(' ')]
N = l[0]
M = l[1]
rows = set()
cols = set()
u = []
for i in range(M):
	l = input().split(' ')
	r = int(l[0])
	c = int(l[1])
	rows.add(r)
	cols.add(c)
	unatt = (N - len(rows)) * (N - len(cols))
	u.append(str(unatt))
print(' '.join(u))


(n, m) = map(int, input().split())
(a, b) = (set(), set())
for i in range(m):
	(x, y) = map(int, input().split())
	a.add(x)
	b.add(y)
	p = len(a)
	q = len(b)
	print(n * n - (p * n + q * n - p * q), end=' ')


import sys
(n, m) = map(int, input().split())
(A, R, C) = ([0] * m, set(), set())
for (i, line) in enumerate(sys.stdin):
	(x, y) = map(int, line.split())
	R.add(x)
	C.add(y)
	A[i] = (n - len(R)) * (n - len(C))
print(' '.join(map(str, A)))


(n, m) = map(int, input().split())
c = set()
r = set()
for i in range(m):
	(x, y) = map(int, input().split())
	c.add(x)
	r.add(y)
	c1 = len(c)
	r1 = len(r)
	print(n * n - (c1 * n + (n - c1) * r1), end=' ')
print('')


(n, m) = map(int, input().split())
cells = n * n
x = set()
y = set()
(y_1, x_1) = map(int, input().split())
x.add(x_1)
y.add(y_1)
ans = []
cells -= 2 * n - 1
ans.append(str(cells))
for i in range(1, m):
	(y_1, x_1) = map(int, input().split())
	x_ex = x_1 in x
	y_ex = y_1 in y
	if x_ex and y_ex:
		cells -= 0
	elif x_ex and (not y_ex):
		cells -= n - len(x)
	elif y_ex and (not x_ex):
		cells -= n - len(y)
	elif not y_ex and (not x_ex):
		cells -= 2 * n - len(x) - len(y) - 1
	x.add(x_1)
	y.add(y_1)
	ans.append(str(cells))
print(' '.join(ans))


string = input()
numbers = string.split()
a = int(numbers[0])
b = int(numbers[1])
r = 0
c = 0
rows = [0 for x in range(a)]
columns = [0 for x in range(a)]
cells = []
for x in range(b):
	string = input()
	numbers = string.split()
	row = int(numbers[0]) - 1
	column = int(numbers[1]) - 1
	if rows[row] == 0:
		rows[row] = 1
		r += 1
	if columns[column] == 0:
		columns[column] = 1
		c += 1
	cells.append((a - r) * (a - c))
print(' '.join(map(str, cells)))


(n, m) = map(int, input().split())
row = [0] * (n + 1)
col = [0] * (n + 1)
cntrow = 0
cntcol = 0
ans = n * n
for i in range(m):
	(x, y) = map(int, input().split())
	if col[x] == 0:
		ans -= n - cntrow - 1
	if row[y] == 0:
		ans -= n - cntcol - 1
	if col[x] == 0 and row[y] == 0:
		ans -= 1
	elif col[x] == 0 or row[y] == 0:
		ans -= 1
	if col[x] == 0:
		col[x] = 1
		cntcol += 1
	if row[y] == 0:
		row[y] = 1
		cntrow += 1
	print(ans, end=' ')


(n, m) = [int(x) for x in input().split()]
r = []
c = []
for i in range(n + 1):
	r.append(0)
	c.append(0)
res = []
rows = 0
cols = 0
board = n * n
for i in range(m):
	(row, col) = [int(x) for x in input().split()]
	if r[row] == 0:
		r[row] = 1
		rows += 1
		board -= n - cols
	if c[col] == 0:
		c[col] = 1
		cols += 1
		board -= n - rows
	res.append(board)
for r in res:
	print(r, end=' ')


import sys
input = sys.stdin.readline()
(n, m) = map(int, input.split())
places = []
for i in range(m):
	input = sys.stdin.readline()
	(x, y) = map(int, input.split())
	places.append([x - 1, y - 1])
rows = [0 for i in range(n)]
row_count = 0
cols = [0 for i in range(n)]
col_count = 0
ans_ar = []
for i in range(m):
	(x, y) = (places[i][0], places[i][1])
	if rows[x] == 0:
		rows[x] = 1
		row_count += 1
	if cols[y] == 0:
		cols[y] = 1
		col_count += 1
	ans = (n - col_count) * (n - row_count)
	ans_ar.append(ans)
print(*ans_ar)


from collections import *
(c, r) = (Counter(), Counter())
(n, k) = map(int, input().split())
ans = []
for i in range(k):
	(i, j) = map(int, input().split())
	(c[i], r[j]) = (1, 1)
	(li, lj) = (len(c), len(r))
	ans.append(n * n - li * n - lj * n + li * lj)
print(*ans)


(n, m) = input().split()
n = int(n)
m = int(m)
saida = []
linhas = set()
colunas = set()
livres = n * n
for i in range(m):
	cordenadas = input().split()
	linha = cordenadas[0]
	coluna = cordenadas[1]
	if linha not in linhas and coluna not in colunas:
		livres -= n + n - 1 - len(linhas) - len(colunas)
		linhas.add(linha)
		colunas.add(coluna)
	elif linha not in linhas:
		linhas.add(linha)
		livres -= n - len(colunas)
	elif coluna not in colunas:
		colunas.add(coluna)
		livres -= n - len(linhas)
	saida.append(livres)
print(*saida)


def main():
	(n, m) = map(int, input().split())
	(res, h, v, t) = ([], [True] * (n + 1), [True] * (n + 1), n * n)
	colcnt = rowcnt = n
	for _ in range(m):
		(x, y) = map(int, input().split())
		if h[y]:
			if v[x]:
				colcnt -= 1
				t -= colcnt + rowcnt
			else:
				t -= colcnt
			rowcnt -= 1
		elif v[x]:
			t -= rowcnt
			colcnt -= 1
		h[y] = v[x] = False
		res.append(t)
	print(' '.join(map(str, res)))
main()


(n, m) = [int(x) for x in input().split()]
cont = n * n
resp = []
colunas_usadas = set([])
linhas_usadas = set([])
for e in range(m):
	(x, y) = [int(a) for a in input().split()]
	if x not in linhas_usadas:
		cont -= n - len(colunas_usadas)
		linhas_usadas.add(x)
	if y not in colunas_usadas:
		cont -= n - len(linhas_usadas)
		colunas_usadas.add(y)
	resp.append(str(cont))
print(' '.join(resp))


(a, s) = input().split()
a = int(a)
s = int(s)
top1 = a
top2 = a
l1 = []
l2 = []
l3 = []
for i in range(0, 100007):
	l1.append(0)
	l2.append(0)
for i in range(0, s):
	(z, x) = input().split()
	z = int(z)
	x = int(x)
	if l1[z] == 0:
		top1 -= 1
		l1[z] = 1
	if l2[x] == 0:
		top2 -= 1
		l2[x] = 1
	l3.append(top1 * top2)
for i in l3:
	print(i, end=' ')


(tamanho_do_tabuleiro, num_de_torres) = map(int, input().split())
linhas_livres = tamanho_do_tabuleiro
colunas_livres = tamanho_do_tabuleiro
colunas = set()
linhas = set()
total_livre = ''
for _ in range(num_de_torres):
	(num_da_linha, num_da_coluna) = map(int, input().split())
	if num_da_linha not in linhas:
		linhas.add(num_da_linha)
		linhas_livres -= 1
	if num_da_coluna not in colunas:
		colunas.add(num_da_coluna)
		colunas_livres -= 1
	total_livre += str(linhas_livres * colunas_livres) + ' '
print(total_livre)


import sys
(n, m) = map(int, input().split())
arr = [list(map(int, input().split())) for i in range(m)]
row = {}
col = {}
for i in range(1, n + 1):
	row[i] = 0
	col[i] = 0
r = n
c = n
for i in range(m):
	if row.get(arr[i][0]) == 0:
		row[arr[i][0]] = 1
		r -= 1
	if col.get(arr[i][1]) == 0:
		col[arr[i][1]] = 1
		c -= 1
	k = r * c
	sys.stdout.write(str(k) + ' ')


(n, m) = map(int, input().split())
t_x = set()
t_y = set()
ans = ''
for _ in range(m):
	(x, y) = map(int, input().split())
	t_x.add(x)
	t_y.add(y)
	ans += str((n - len(t_x)) * (n - len(t_y))) + ' '
print(ans)


import collections
(n, m) = [int(s) for s in input().split(' ')]
free_rows = set(range(n))
free_cols = set(range(n))
nums = []
for i in range(m):
	(x, y) = [int(s) for s in input().split(' ')]
	free_rows.discard(x - 1)
	free_cols.discard(y - 1)
	nums.append(len(free_rows) * len(free_cols))
print(*nums, sep=' ')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	(n, m) = LI()
	aa = [LI() for _ in range(m)]
	c = set()
	d = set()
	e = n
	f = n
	rr = []
	for (a, b) in aa:
		if a not in c:
			c.add(a)
			e -= 1
		if b not in d:
			d.add(b)
			f -= 1
		rr.append(e * f)
	return ' '.join(map(str, rr))
print(main())


(n, m) = list(map(int, input().split()))
columns = set()
rows = set()
results = []
for _ in range(m):
	(x, y) = list(map(int, input().split()))
	columns.add(x)
	rows.add(y)
	result = n * (n - len(columns)) - (n - len(columns)) * len(rows)
	results.append(result)
print(' '.join(map(str, results)))


(n, m) = map(int, input().split())
rowList = [0 for _ in range(n)]
colList = [0 for _ in range(n)]
rowRooks = 0
colRooks = 0
totalUnattacked = n * n
finalList = []
for _ in range(m):
	(r, c) = map(int, input().split())
	r -= 1
	c -= 1
	if rowList[r] == 0:
		rowList[r] = 1
		totalUnattacked -= n
		totalUnattacked += colRooks
		rowRooks += 1
	if colList[c] == 0:
		colList[c] = 1
		totalUnattacked -= n
		totalUnattacked += rowRooks
		colRooks += 1
	finalList.append(totalUnattacked)
for i in range(len(finalList)):
	print(finalList[i], end=' ')


tempInput = input()
tempArr = tempInput.split()
tableSize = int(tempArr[0])
pointCount = int(tempArr[1])
rowDict = {}
columnDict = {}
resultArr = []
index = 0
while index < pointCount:
	locationStr = input()
	locationArr = locationStr.split()
	rowDict[locationArr[0]] = 0
	columnDict[locationArr[1]] = 0
	remaindCell = (tableSize - len(rowDict.keys())) * (tableSize - len(columnDict.keys()))
	resultArr.append(str(remaindCell))
	index += 1
resultStr = ' '.join(resultArr)
print(resultStr)


(n, m) = map(int, input().split())
xvis = [False] * (n + 1)
yvis = [False] * (n + 1)
xc = 0
yc = 0

def cal():
	s = (n - xc) * n - (n - xc) * yc
	return s
for i in range(m):
	(x, y) = map(int, input().split())
	if not xvis[x]:
		xvis[x] = True
		xc += 1
	if not yvis[y]:
		yvis[y] = True
		yc += 1
	print(cal(), end=' ')


(n, m) = tuple(map(int, input().split()))
x = set()
y = set()
res = []
for i in range(m):
	(a, b) = tuple(map(int, input().split()))
	x.add(a)
	y.add(b)
	res.append(n ** 2 - (n * len(x) + n * len(y) - len(x) * len(y)))
print(*res)


(N, M) = map(int, input().split())
r = N
c = N
R = [False for i in range(N)]
C = R.copy()
for i in range(M):
	(a, b) = map(int, input().split())
	if not R[a - 1]:
		r -= 1
		R[a - 1] = True
	if not C[b - 1]:
		c -= 1
		C[b - 1] = True
	print(r * c, end=' ')


(n, m) = map(int, input().split())
ra = [False for i in range(n)]
rb = 0
ca = [False for i in range(n)]
cb = 0
total = n ** 2
for i in range(m):
	(x, y) = map(int, input().split())
	m = 0
	if not ra[x - 1]:
		m += n - cb
		ra[x - 1] = True
		rb += 1
	if not ca[y - 1]:
		m += n - rb
		ca[y - 1] = True
		cb += 1
	total -= m
	print(total, end=' ')


(RowSet, ColSet, X) = (set(), set(), list(map(int, input().split())))
for _ in range(X[1]):
	Temp = list(map(int, input().split()))
	RowSet.add(Temp[0])
	ColSet.add(Temp[1])
	print((X[0] - len(ColSet)) * (X[0] - len(RowSet)), end=' ')


(n, m) = map(int, input().split())
(c, r, ans) = (set(), set(), [])
for i in range(m):
	(x, y) = map(int, input().split())
	c.add(x)
	r.add(y)
	ans += [str((n - len(c)) * (n - len(r)))]
print(' '.join(ans))


from sys import stdin, stdout
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(n, m) = iia()
rows = set()
col = set()
ans = []
for _ in range(m):
	(a, b) = iia()
	rows.add(a)
	col.add(b)
	ans.append((n - len(rows)) * (n - len(col)))
print(*ans)


I = lambda : map(int, input().split())
(n, m) = I()
R = [True] * 100001
C = [True] * 100001
c = n
r = n
for i in range(m):
	(x, y) = I()
	r -= R[x]
	c -= C[y]
	C[y] = False
	R[x] = False
	print(r * c, end=' ')


from sys import stdin
stdin.readline

def get_ints():
	return list(map(int, stdin.readline().strip().split()))

def it():
	return int(input())
(n, m) = get_ints()
(a1, a2) = (set(), set())
ans = 0
v = []
for _ in range(m):
	(x, y) = get_ints()
	a1.add(x)
	a2.add(y)
	c = n * len(a1) + n * len(a2) - len(a1) * len(a2)
	ans = n * n - c
	v.append(ans)
print(*v)


def pro():
	(n, m) = map(int, input().split())
	x = [False for i in range(n)]
	x1 = n
	y = [False for i in range(n)]
	y1 = n
	for i in range(m):
		(k, l) = map(int, input().split())
		if not x[k - 1]:
			x[k - 1] = True
			x1 -= 1
		if not y[l - 1]:
			y[l - 1] = True
			y1 -= 1
		print(x1 * y1, end=' ')
pro()


cnt = lambda s, x: s.count(x)
ii = lambda : int(input())
si = lambda : input()
f = lambda : map(int, input().split())
dgl = lambda : list(map(int, input()))
il = lambda : list(map(int, input().split()))
(n, k) = f()
(a, b) = (set(), set())
for i in range(k):
	(x, y) = f()
	a.add(x)
	b.add(y)
	print((n - len(a)) * (n - len(b)), end=' ')


(n, m) = map(int, input().split())
ans = ''
col = set()
row = set()
for i in range(m):
	(x, y) = map(int, input().split())
	row.add(x)
	col.add(y)
	cnt = len(row) * n + len(col) * n - len(col) * len(row)
	ans += f'{n * n - cnt} '
print(ans)


(n, m) = map(int, input().split())
x = set()
y = set()
l = []
for i in range(m):
	(a, b) = map(int, input().split())
	l.append((a, b))
for i in range(m):
	(a, b) = l[i]
	x.add(a)
	y.add(b)
	ans = (n - len(x)) * (n - len(y))
	print(ans, end=' ')


(n, m) = map(int, input().strip().split())
tot = n * n
atk_rows = set()
atk_cols = set()
for t in range(m):
	(r, c) = map(int, input().strip().split())
	if r in atk_rows and c in atk_cols:
		pass
	elif r in atk_rows:
		tot -= n - len(atk_rows)
	elif c in atk_cols:
		tot -= n - len(atk_cols)
	else:
		tot -= 2 * n - len(atk_rows) - len(atk_cols) - 1
	atk_rows.add(r)
	atk_cols.add(c)
	print(tot, end=' ')
print('')


(n, m) = map(int, input().split())
row = [False] * 1000000
col = [False] * 1000000
result = [0] * 1000000
rowLeft = n
colLeft = n
for i in range(m):
	(x, y) = map(int, input().split())
	if False == row[x]:
		rowLeft -= 1
	if col[y] == False:
		colLeft -= 1
	row[x] = True
	col[y] = True
	result[i] = rowLeft * colLeft
for i in range(m):
	print(result[i], end=' ')


(n, m) = map(int, input().split())
row = set()
col = set()
cells = n * n
for i in range(m):
	(r, c) = map(int, input().split())
	row.add(r)
	col.add(c)
	cnt = len(row) * n + len(col) * n - len(row) * len(col)
	print(cells - cnt, end=' ')


(n, m) = map(int, input().split())
dx = {}
dy = {}
nx = ny = n
for _ in range(m):
	(x, y) = map(int, input().split())
	if not dx.get(x):
		dx[x] = 1
		nx -= 1
	if not dy.get(y):
		dy[y] = 1
		ny -= 1
	print(nx * ny, end=' ')


import sys
(n, rooks) = map(int, input().split())
rows = [False for _ in range(n + 1)]
columns = [False for _ in range(n + 1)]
empty_rows = n
empty_columns = n
for i in range(rooks):
	(x, y) = map(int, input().split())
	if not rows[x]:
		rows[x] = True
		empty_rows -= 1
	if not columns[y]:
		columns[y] = True
		empty_columns -= 1
	if i == rooks - 1:
		print(empty_rows * empty_columns)
	else:
		print(empty_rows * empty_columns, end=' ')


from sys import stdin as sin
(n, m) = map(int, input().split())
g = n * n
l = []
x = set()
y = set()
for i in range(m):
	(a, b) = map(int, input().split())
	if a not in x and b not in y:
		g += 1
	if a not in x:
		g -= max(n - len(y), 0)
	if b not in y:
		g -= max(n - len(x), 0)
	y.add(b)
	x.add(a)
	l.append(g)
print(*l, end=' ')


(n, m) = map(int, input().split())
xyi = [list(map(int, input().split())) for i in range(m)]
x = [0] * (n + 1)
y = [0] * (n + 1)
numx = 0
numy = 0
num = n * n
for i in range(m):
	if x[xyi[i][0]] == 0:
		num += numy - n
		numx += 1
		x[xyi[i][0]] = 1
	if y[xyi[i][1]] == 0:
		num += numx - n
		numy += 1
		y[xyi[i][1]] = 1
	print(num, end=' ')


import math
(n, m) = map(int, input().split())
x = set([])
y = set([])
for i in range(m):
	(a, b) = map(int, input().split())
	x.add(a)
	y.add(b)
	union = n * len(x) + n * len(y) - len(x) * len(y)
	print(n ** 2 - union, end=' ')


(n, m) = map(int, input().strip().split())
tot = n * n
atk_rows = [0 for i in range(n + 1)]
atk_cols = [0 for i in range(n + 1)]
nrows = 0
ncols = 0
for t in range(m):
	(r, c) = map(int, input().strip().split())
	if atk_cols[c] and atk_rows[r]:
		pass
	elif atk_rows[r]:
		tot -= n - nrows
		ncols += 1
	elif atk_cols[c]:
		tot -= n - ncols
		nrows += 1
	else:
		tot -= 2 * n - nrows - ncols - 1
		ncols += 1
		nrows += 1
	atk_cols[c] = 1
	atk_rows[r] = 1
	print(tot, end=' ')
print('')


(n, m) = map(int, input().split())
stolb = set()
strok = set()
for i in range(m):
	(x, y) = map(int, input().split())
	stolb.add(x)
	strok.add(y)
	print(n * n - n * len(strok) - n * len(stolb) + len(strok) * len(stolb), end=' ')


(n, m) = list(map(int, input().split()))
a = set()
b = set()
c = []
for gogogo in range(m):
	(naxer, nuzno) = list(map(int, input().split()))
	a.add(naxer)
	b.add(nuzno)
	c.append((n - len(a)) * (n - len(b)))
print(*c)


import sys
input = sys.stdin.readline

def main():
	(n, m) = map(int, input().split())
	x = set()
	y = set()
	for _ in range(m):
		(xi, yi) = map(int, input().split())
		x.add(xi)
		y.add(yi)
		print(n * n - len(x) * n + len(y) * (len(x) - n), end=' ')
	print()
main()


(a, b) = map(int, input().split())
xes = set()
yes = set()
for x in range(b):
	(c, d) = map(int, input().split())
	xes.add(c)
	yes.add(d)
	print((a - len(xes)) * (a - len(yes)), end=' ')


(n, m) = map(int, input().split())
(X, Y) = (set(), set())
for _ in range(m):
	(x, y) = map(int, input().split())
	X.add(x)
	Y.add(y)
	print((n - len(X)) * (n - len(Y)), end=' ')


[n, m] = list(map(int, input().split()))
rs = set()
cs = set()
res = []
for i in range(m):
	[x, y] = list(map(int, input().split()))
	rs.add(x)
	cs.add(y)
	a = len(rs)
	b = len(cs)
	cur = n * n - n * (a + b) + a * b
	res.append(cur)
print(' '.join(map(str, res)))


(n, m) = map(int, input().split())
rows = set(range(1, n + 1))
columns = set(range(1, n + 1))
for i in range(m):
	(x, y) = map(int, input().split())
	rows.discard(x)
	columns.discard(y)
	print(len(rows) * len(columns), end=' ')
print()


(a, b) = map(int, input().split())
c = set()
d = set()
e = []
for _ in range(b):
	(f, g) = map(int, input().split())
	c |= set([f])
	d |= set([g])
	e += [(a - len(c)) * (a - len(d))]
print(' '.join(map(str, e)))


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial
INT_MIN = float('-infinity')
INT_MAX = float('infinity')
(n, m) = map(int, input().split())
row = set()
col = set()
su = n * n
for i in range(m):
	(a, b) = map(int, input().split())
	if a not in row:
		su -= n - len(col)
	row.add(a)
	if b not in col:
		su -= n - len(row)
	col.add(b)
	print(su, end=' ')


(n, m) = list(map(int, input().split()))
b = set()
s = n ** 2
safe = []
xa = set()
ya = set()
for i in range(m):
	(x, y) = list(map(int, input().split()))
	x -= 1
	y -= 1
	xa.add(x)
	ya.add(y)
	t = s - len(xa) * n - len(ya) * n + len(xa) * len(ya)
	if t < 0:
		t = 0
	safe.append(str(t))
print(' '.join(safe))


tempInput = input()
tempArr = tempInput.split()
tableSize = int(tempArr[0])
pointCount = int(tempArr[1])
rowDict = {}
columnDict = {}
pointArr = []
index = 0
while index < pointCount:
	locationStr = input()
	locationArr = locationStr.split()
	pointArr.append(locationArr)
	index += 1
resultArr = []
for i in range(pointCount):
	location = pointArr[i]
	rowDict[location[0]] = 0
	columnDict[location[1]] = 0
	remaindCell = (tableSize - len(rowDict.keys())) * (tableSize - len(columnDict.keys()))
	resultArr.append(str(remaindCell))
resultStr = ' '.join(resultArr)
print(resultStr)


(n, m) = [int(d) for d in input().split()]
cols = [None] * n
rows = [None] * n
nCols = n
nRows = n
N = []
for i in range(m):
	(row, col) = [int(d) for d in input().split()]
	if not rows[row - 1]:
		rows[row - 1] = 1
		nRows -= 1
	if not cols[col - 1]:
		cols[col - 1] = 1
		nCols -= 1
	N.append(nCols * nRows)
for i in N:
	print(i, end=' ')


def main():
	(n, m) = map(int, input().split())
	hor = set()
	ver = set()
	for i in range(m):
		(x, y) = map(int, input().split())
		hor.add(x)
		ver.add(y)
		print(n ** 2 - (len(hor) * n + len(ver) * n - len(hor) * len(ver)), end=' ')
	print()
main()


(n, m) = [int(x) for x in input().split()]
eff_row = n
eff_col = n
row = [False] * n
col = [False] * n
for i in range(m):
	(r, c) = [int(x) for x in input().split()]
	if not row[r - 1]:
		eff_row -= 1
	if not col[c - 1]:
		eff_col -= 1
	row[r - 1] = True
	col[c - 1] = True
	print(eff_row * eff_col, end=' ')


(n, m) = list(map(int, input().split()))
pos = [None] * m * 2
for i in range(m):
	(pos[i * 2], pos[i * 2 + 1]) = list(map(int, input().split()))
count = n * n
row = col = n
row_pos = [False] * n
col_pos = [False] * n
for i in range(m):
	cur_row = pos[i * 2] - 1
	cur_col = pos[i * 2 + 1] - 1
	if not row_pos[cur_row] and (not col_pos[cur_col]):
		row_pos[cur_row] = col_pos[cur_col] = True
		row -= 1
		col -= 1
		count -= row + col + 1
	elif not row_pos[cur_row]:
		row_pos[cur_row] = True
		row -= 1
		count -= col
	elif not col_pos[cur_col]:
		col_pos[cur_col] = True
		col -= 1
		count -= row
	print(count, end=' ')


(n, m) = map(int, input().split())
rl = [0] * (n + 1)
cl = [0] * (n + 1)
rv = n
cv = n
for _ in range(m):
	(r, c) = map(int, input().split())
	if rl[r] == 0:
		if rv > 0:
			rv -= 1
		rl[r] = 1
	if cl[c] == 0:
		if cv > 0:
			cv -= 1
		cl[c] = 1
	print(rv * cv, end=' ')


(n, m) = map(int, input().split())
lad = [[0] * 2 for i in range(m)]
k = n * n
is_hear_y = set()
is_hear_x = set()
for j in range(m):
	(lad[j][0], lad[j][1]) = map(int, input().split())
for j in range(m):
	(x, y) = (lad[j][0] - 1, lad[j][1] - 1)
	if x not in is_hear_x:
		k -= n - len(is_hear_y)
		is_hear_x.add(x)
	if y not in is_hear_y:
		k -= n - len(is_hear_x)
		is_hear_y.add(y)
	print(k, end=' ')


(n, m) = map(int, input().split())
arr1 = [0] * n
arr2 = [0] * n
sz1 = n
sz2 = n
l = []
for _ in range(m):
	(x, y) = map(int, input().split())
	if arr1[x - 1] == 0:
		arr1[x - 1] = 1
		sz1 -= 1
	if arr2[y - 1] == 0:
		arr2[y - 1] = 1
		sz2 -= 1
	l.append(sz1 * sz2)
print(*l, sep=' ')


(n, m) = list(map(int, input().strip().split()))
remains = n * n
deleted_rows = set()
deleted_cols = set()
answer = []
for _ in range(m):
	(c, r) = list(map(int, input().strip().split()))
	col_deleted = c in deleted_cols
	row_deleted = r in deleted_rows
	if not (col_deleted and row_deleted):
		if col_deleted:
			remains -= n - len(deleted_cols)
		elif row_deleted:
			remains -= n - len(deleted_rows)
		else:
			remains -= 2 * n - len(deleted_cols) - len(deleted_rows) - 1
	deleted_cols.add(c)
	deleted_rows.add(r)
	answer.append(str(remains))
print(' '.join(answer))


(n, m) = map(int, input().split())
(X, Y) = (set(), set())
(lx, ly) = (0, 0)
ans = []
for i in range(m):
	(x, y) = map(int, input().split())
	if x not in X:
		lx += 1
		X.add(x)
	if y not in Y:
		ly += 1
		Y.add(y)
	ans += [str((n - lx) * (n - ly))]
print(' '.join(ans))


from collections import deque as d
(n, m) = map(int, input().split())
col = set()
row = set()
res = d()
for _ in range(m):
	(x, y) = map(int, input().split())
	col.add(y)
	row.add(x)
	res.append(str((n - len(col)) * (n - len(row))))
print(' '.join(res))


import sys, os
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
from collections import defaultdict
(n, m) = map(int, input().split())
(row, column) = (defaultdict(int), defaultdict(int))
(ans, r1, c1) = (n * n, n, n)
for i in range(m):
	(r, c) = map(int, input().split())
	if row[r] == 0:
		ans -= c1
		r1 -= 1
		row[r] += 1
	if column[c] == 0:
		ans -= r1
		c1 -= 1
		column[c] += 1
	print(ans, end=' ')


(n, m) = map(int, input().split())
g = set()
v = set()
for k in range(m):
	(a, b) = map(int, input().split())
	g.add(a)
	v.add(b)
	print((n - len(g)) * (n - len(v)), end=' ')


(n, m) = map(int, input().split())
(rows, cols) = (set(), set())
ans = []
for _ in range(m):
	(r, c) = map(int, input().split())
	rows.add(r)
	cols.add(c)
	under_attack = len(rows) * n + len(cols) * (n - len(rows))
	ans.append(n * n - under_attack)
print(*ans)


(N, M) = map(int, input().split())
seth = set([])
setw = set([])
now = N * N
ans = []
for i in range(M):
	(h, w) = map(int, input().split())
	tmp = 0
	if h not in seth:
		tmp += N - len(setw)
	if w not in setw:
		tmp += N - len(seth)
	if h not in seth and w not in setw:
		tmp -= 1
	seth.add(h)
	setw.add(w)
	now -= tmp
	ans.append(now)
print(' '.join(map(str, ans)))


(n, m) = [int(i) for i in input().split()]
pos = [[int(i) for i in input().split()] for j in range(m)]
x = set()
y = set()
t = n * n
for i in pos:
	x.add(i[0])
	y.add(i[1])
	print(t - (n * len(x) + n * len(y) - len(x) * len(y)), end=' ')


(n, m) = map(int, input().split())
strok = [0] * (n + 1)
stolb = [0] * (n + 1)
stol = 0
stro = 0
otvat = [str(n ** 2)]
for i in range(1, m + 1):
	k = 0
	l = list(map(int, input().split()))
	if strok[l[0]] == 0:
		strok[l[0]] = 1
		k += n - stol
		stro += 1
	if stolb[l[1]] == 0:
		stolb[l[1]] = 1
		k += n - stro
		stol += 1
	otvat.append(str(int(otvat[i - 1]) - k))
print(' '.join(otvat[1:]))


(n, m) = map(int, input().split())
all_x = set()
all_y = set()
ans = []
for i in range(m):
	(x, y) = map(int, input().split())
	all_x.add(x)
	all_y.add(y)
	ans.append((n - len(all_x)) * (n - len(all_y)))
print(*ans)


(n, m) = map(int, input().split())
result = []
unbeaten = n * n
rows = set()
columns = set()
for i in range(m):
	(x, y) = map(int, input().split())
	newRowAndCol = True
	if x not in rows:
		unbeaten -= n - 1 - len(columns) + (1 if y in columns else 0)
	else:
		newRowAndCol = False
	if y not in columns:
		unbeaten -= n - 1 - len(rows) + (1 if x in rows else 0)
	else:
		newRowAndCol = False
	if newRowAndCol:
		unbeaten -= 1
	result.append(unbeaten)
	rows.add(x)
	columns.add(y)
for x in result:
	print(x, end=' ')


def calculate_ans(n, rooks):
	(set1, set2) = (set(), set())
	answer = []
	total = n ** 2
	for rook in rooks:
		(x, y) = rook
		if x in set1 and y in set2:
			pass
		elif x in set1:
			total -= n - len(set1)
		elif y in set2:
			total -= n - len(set2)
		else:
			total -= n - len(set1) + (n - len(set2)) - 1
		set1.add(x)
		set2.add(y)
		answer.append(total)
	return answer
(n, m) = map(int, input().split())
rooks = [tuple(map(int, input().split())) for _ in range(m)]
answer = calculate_ans(n, rooks)
print(' '.join(map(str, answer)))


(n, m) = map(int, input().split())
s1 = set()
s2 = set()
for i in range(m):
	(a, b) = map(int, input().split())
	s1.add(a)
	s2.add(b)
	print((n - len(s1)) * (n - len(s2)), end=' ')


s = input()
(n, m) = s.split()
n = int(n)
m = int(m)
L = list()
for i in range(m):
	ss = input()
	(x, y) = ss.split()
	x = int(x)
	y = int(y)
	L.append((x, y))
L1 = [0 for x in range(n + 1)]
L2 = [0 for y in range(n + 1)]
cot1 = 0
cot2 = 0
ans = n * n
for j in range(m):
	flag1 = 0
	flag2 = 0
	if L1[L[j][0]] is 0:
		ans = ans - n + cot2
		L1[L[j][0]] = 1
		flag1 = 1
	if L2[L[j][1]] is 0:
		ans = ans - n + cot1
		L2[L[j][1]] = 1
		cot2 += 1
		flag2 = 1
	if flag1:
		cot1 += 1
	if flag1 and flag2:
		ans += 1
	print(ans, end=' ')


(n, m) = map(int, input().split())
col = set([])
row = set([])
s = n * n
l = []
for i in range(m):
	(x, y) = map(int, input().split())
	if x not in col and y not in row:
		s -= 2 * n - 1 - len(row) - len(col)
	elif y not in row and x in col:
		s -= n - len(col)
	elif x not in col and y in row:
		s -= n - len(row)
	l.append(s)
	col.add(x)
	row.add(y)
print(*l)


(n, m) = map(int, input().split())
x = n * n
aa = set()
bb = set()
for i in range(m):
	(a, b) = map(int, input().split())
	aa.add(a)
	bb.add(b)
	q = len(aa) * n + len(bb) * (n - len(aa))
	print(x - q, end=' ')


(n, m) = map(int, input().split())
s_sy = set()
s_sx = set()
for _ in range(m):
	(x, y) = map(int, input().split())
	s_sy.add(y)
	s_sx.add(x)
	print(n * n - ((len(s_sx) + len(s_sy)) * n - len(s_sx) * len(s_sy)), end=' ')


import sys
row = set()
col = set()
tmp = [int(x) for x in sys.stdin.readline().split()]
(n, m) = (tmp[0], tmp[1])
for i in range(m):
	tmp = [int(x) for x in sys.stdin.readline().split()]
	(x, y) = (tmp[0], tmp[1])
	row.add(x)
	col.add(y)
	underAttack = (len(row) + len(col)) * n - len(row) * len(col)
	sys.stdout.write(str(n * n - underAttack) + ' ')


(n, m) = map(int, input().split())
strings = set()
columns = set()
ans = []
for i in range(m):
	(x, y) = map(int, input().split())
	strings.add(x)
	columns.add(y)
	ans.append(n * n - n * (len(strings) + len(columns)) + len(strings) * len(columns))
print(*ans)


from collections import defaultdict
(n, m) = map(int, input().split())
Row = defaultdict(bool)
Col = defaultdict(bool)
R = C = 0
Ans = n * n
AnsList = []
for _ in range(m):
	(row, col) = map(int, input().split())
	if Row[row] == False and Col[col] == False:
		Ans -= n - R + (n - C) - 1
		R += 1
		C += 1
		Row[row] = Col[col] = True
		AnsList.append(Ans)
	elif Row[row] == True and Col[col] == False:
		Ans -= n - R
		C += 1
		Col[col] = True
		AnsList.append(Ans)
	elif Row[row] == False and Col[col] == True:
		Ans -= n - C
		R += 1
		Row[row] = True
		AnsList.append(Ans)
	else:
		AnsList.append(Ans)
print(*AnsList)


s = input()
s = [int(x) for x in s.split()]
n = s[0]
m = s[1]
X = set()
Y = set()
for i in range(m):
	s = input()
	s = [int(x) for x in s.split()]
	X.add(s[0])
	Y.add(s[1])
	print((n - len(X)) * (n - len(Y)), end=' ')


def main():
	(n, m) = map(int, input().split())
	row_remains = n
	col_remains = n
	row_used = dict()
	col_used = dict()
	ans = list()
	for i in range(m):
		(x, y) = map(int, input().split())
		if x not in row_used:
			row_used[x] = True
			row_remains -= 1
		if y not in col_used:
			col_used[y] = True
			col_remains -= 1
		ans.append(row_remains * col_remains)
	print(' '.join((str(x) for x in ans)))
main()


(tamanho_tab, numero_rooks) = list(map(int, input().split()))
tabul = tamanho_tab * tamanho_tab
linhas_usadas = set()
colunas_usadas = set()
ocupadas = 0
retorno = ''
for _ in range(numero_rooks):
	pos = list(map(int, input().split()))
	row_oc = pos[0] in linhas_usadas
	coll_oc = pos[1] in colunas_usadas
	if row_oc and coll_oc:
		retorno += str(tabul - ocupadas) + ' '
		continue
	if not row_oc:
		linhas_usadas.add(pos[0])
	if not coll_oc:
		colunas_usadas.add(pos[1])
	colunas = len(colunas_usadas)
	linhas = len(linhas_usadas)
	ocupadas = colunas * tamanho_tab + linhas * tamanho_tab - linhas * colunas
	retorno += str(tabul - ocupadas) + ' '
print(retorno[:-1])


from sys import stdout, stdin
(a, b) = map(int, stdin.readline().split())
z_row = [0] * (a + 1)
z_col = [0] * (a + 1)
z_row1 = 0
z_col1 = 0
s = a * a
o = ''
for _ in ' ' * b:
	k = 0
	(x, y) = map(int, stdin.readline().split())
	if z_row[x] == 0:
		s -= a - z_col1
		k = -1
	if z_col[y] == 0:
		s -= k + a - z_row1
	if z_row[x] == 0:
		z_row1 += 1
	if z_col[y] == 0:
		z_col1 += 1
	z_row[x] = 1
	z_col[y] = 1
	o += str(s) + ' '
stdout.write(o)


import sys

def f():
	_input = sys.stdin.readlines()
	(n, m) = [int(i) for i in _input[0].strip().split(' ')]
	num_cells = n ** 2
	(row, col) = (set([]), set([]))
	res = []
	for i in range(1, m + 1):
		(x, y) = _input[i].strip().split(' ')
		(x, y) = (int(x), int(y))
		if x not in row and y not in col:
			num_cells -= 2 * n - 1 - len(row) - len(col)
		elif y in col and x not in row:
			num_cells -= n - len(col)
		elif x in row and y not in col:
			num_cells -= n - len(row)
		res.append(str(num_cells))
		row.add(x)
		col.add(y)
	print(' '.join(res))
f()


class CodeforcesTask701BSolution:

	def __init__(self):
		self.result = ''
		self.n_m = []
		self.positions = []

	def read_input(self):
		self.n_m = [int(x) for x in input().split(' ')]
		for x in range(self.n_m[1]):
			self.positions.append([int(y) for y in input().split(' ')])

	def process_task(self):
		colcnt = 0
		rowcnt = 0
		n = self.n_m[0]
		rows = [0] * n
		cols = [0] * n
		results = []
		for rook in self.positions:
			if not rows[rook[0] - 1]:
				rows[rook[0] - 1] = 1
				rowcnt += 1
			if not cols[rook[1] - 1]:
				cols[rook[1] - 1] = 1
				colcnt += 1
			results.append((n - rowcnt) * (n - colcnt))
		self.result = ' '.join([str(x) for x in results])

	def get_result(self):
		return self.result
Solution = CodeforcesTask701BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(n, m) = map(int, input().strip().split())
x = set()
y = set()
ans = []
for i in range(m):
	(xi, yi) = map(int, input().strip().split())
	x.add(xi)
	y.add(yi)
	attacked = len(x) * n + len(y) * n - len(x) * len(y)
	not_attacked = n * n - attacked
	ans.append(not_attacked)
print(*ans)


(n, m) = map(int, input().split())
cols = set()
rows = set()
out = []
for _ in range(m):
	(x, y) = map(int, input().split())
	cols.add(x)
	rows.add(y)
	out.append(str((n - len(cols)) * (n - len(rows))))
print(' '.join(out))


(size, rook) = map(int, input().split())
rows = []
cols = []
rowCount = 0
colCount = 0
attacks = []
for i in range(size):
	rows.append(0)
	cols.append(0)
for i in range(rook):
	(x, y) = map(int, input().split())
	(x, y) = (x - 1, y - 1)
	if rows[x] == 0:
		rowCount += 1
	if cols[y] == 0:
		colCount += 1
	rows[x] += 1
	cols[y] += 1
	attacks.append((size - rowCount) * (size - colCount))
print(*attacks)


ladya = [int(x) for x in input().split(' ')]
N = ladya[0]
M = ladya[1]
rows = set()
cols = set()
answer = []
for i in range(M):
	ladya = input().split(' ')
	rows.add(int(ladya[0]))
	cols.add(int(ladya[1]))
	noattack = (N - len(cols)) * (N - len(rows))
	answer.append(str(noattack))
print(' '.join(answer))


I = lambda : map(int, input().split())
(n, m) = I()
result = []
columns = set()
rows = set()
for i in range(m):
	(l, c) = I()
	rows.add(l)
	columns.add(c)
	result.append((n - len(columns)) * (n - len(rows)))
print(*result[:])


(n, m) = map(int, input().split())
total = n * n
xFlag = [False] * n
yFlag = [False] * n
xused = 0
yused = 0
res = ''
for i in range(m):
	(x, y) = map(int, input().split())
	if not xFlag[x - 1]:
		total -= n - yused
		xFlag[x - 1] = True
		xused += 1
	if not yFlag[y - 1]:
		total -= n - xused
		yFlag[y - 1] = True
		yused += 1
	res += str(total)
	res += ' '
print(res)


(n, m) = map(int, input().split())
free_verticals = set(range(1, n + 1))
free_horizontals = set(range(1, n + 1))
for _ in range(m):
	(x, y) = map(int, input().split())
	free_verticals.discard(x)
	free_horizontals.discard(y)
	print(len(free_horizontals) * len(free_verticals), end=' ')
print()


(n, m) = map(int, input().split())
arr = []
dict1 = {}
dict2 = {}
ans = n * n
for i in range(m):
	(x, y) = map(int, input().split())
	try:
		dict1[x] += 1
	except:
		KeyError
		dict1[x] = 1
	try:
		dict2[y] += 1
	except:
		KeyError
		dict2[y] = 1
	val = len(dict1) * n
	val += len(dict2) * n
	val -= len(dict1) * len(dict2)
	arr.append(ans - val)
print(*arr)


import sys

def main():
	reader = (tuple(map(int, line.split())) for line in sys.stdin)
	(n, m) = next(reader)
	rooks = list(reader)
	row_n = n
	col_n = n
	rows = [False for _ in range(n)]
	cols = [False for _ in range(n)]
	for rook in rooks:
		if rows[rook[0] - 1]:
			pass
		else:
			row_n -= 1
			rows[rook[0] - 1] = True
		if cols[rook[1] - 1]:
			pass
		else:
			col_n -= 1
			cols[rook[1] - 1] = True
		rest = row_n * col_n
		print(rest, end=' ')
main()


(n, m) = map(int, input().split())
r = set()
c = set()
k = []
for i in range(m):
	(x, y) = map(int, input().split())
	c.add(y)
	r.add(x)
	k.append(n * n - (len(c) * n + len(r) * n - len(c) * len(r)))
print(*k)


(n, m) = [int(x) for x in input().split()]
horiz = [False] * 100005
vert = [False] * len(horiz)
horiz_cnt = 0
vert_cnt = 0
cnt = 0
sols = []
for i in range(m):
	(x, y) = [int(x) for x in input().split()]
	if not horiz[x]:
		horiz[x] = True
		horiz_cnt += 1
		cnt += n
		cnt -= vert_cnt
	if not vert[y]:
		vert[y] = True
		vert_cnt += 1
		cnt += n
		cnt -= horiz_cnt
	sols.append(n ** 2 - cnt)
print(' '.join([str(x) for x in sols]))


(m, n) = map(int, input().split())
(s, q) = (m, m)
row = [0] * (m + 1)
co = [0] * (m + 1)
for i in range(n):
	(a, b) = map(int, input().split())
	if row[a] == 0:
		row[a] = 1
		s = s - 1
	if co[b] == 0:
		co[b] = 1
		q = q - 1
	if i != n - 1:
		print(s * q, end=' ')
	else:
		print(s * q)


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
l = [False] * (n + 1)
c = [False] * (n + 1)
(x, y) = (n, n)
for _ in range(m):
	(xi, yi) = map(int, input().split())
	if not l[xi]:
		l[xi] = True
		x -= 1
	if not c[yi]:
		c[yi] = True
		y -= 1
	print(x * y, end=' ')


(n, m) = list(map(int, input().split(' ')))
(rows, columns) = ({}, {})
sum_one = 0
output = []
for _ in range(m):
	(x, y) = list(map(int, input().split(' ')))
	if x not in rows:
		rows[x] = []
	if y not in columns:
		columns[y] = []
	rows[x].append(y)
	columns[y].append(x)
	nrows = len(rows) * n
	ncolumns = len(columns) * n
	ncolumns -= len(columns) * len(rows)
	res = nrows + ncolumns
	output.append(n * n - res)
for i in output:
	print(i, end=' ')
print('')


MAX_NUM = 100007

def change_mat(x, y, mat):
	n = len(mat)
	mat[y] = ['#'] * n
	for i in range(n):
		mat[i][x] = '#'
	for i in range(len(mat)):
		print(' '.join(mat[i]))
	print()

def main():
	(n, m) = map(int, input().split())
	(hs_len, vs_len) = (0, 0)
	(hs, vs) = ([0] * MAX_NUM, [0] * MAX_NUM)
	res = n * n
	out = []
	for i in range(m):
		(x, y) = map(int, input().split())
		if vs[x] == 0:
			vs[x] = 1
			vs_len += 1
			res -= n - hs_len
		if hs[y] == 0:
			hs[y] = 1
			hs_len += 1
			res -= n - vs_len
		out.append(str(res))
	print(' '.join(out))
main()


(n, m) = map(int, input().split())
total = n * n
death = 0
res = ''
(rows, cols) = (set(), set())
(n_rows, n_cols) = (0, 0)
for _ in range(m):
	(row, col) = map(int, input().split())
	if row not in rows:
		rows.add(row)
		n_rows += 1
		death += n - n_cols
	if col not in cols:
		cols.add(col)
		n_cols += 1
		death += n - n_rows
	res += str(total - death) + ' '
print(res[:-1])


(n, m) = map(int, input().split())
r = []
xs = set()
ys = set()
xx = n
yy = n
for i in range(m):
	(x, y) = map(int, input().split())
	if x in xs and y in ys:
		pass
	elif x in xs:
		if yy > 0:
			yy -= 1
		ys.add(y)
	elif y in ys:
		if xx > 0:
			xx -= 1
		xs.add(x)
	else:
		if xx > 0:
			xx -= 1
		if yy > 0:
			yy -= 1
		xs.add(x)
		ys.add(y)
	print(xx * yy, end=' ')
print()


import sys
inf = float('inf')
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(n, m) = get_ints()
hori = set()
hl = 0
ver = set()
vl = 0
while m > 0:
	(x, y) = get_ints()
	if x not in hori:
		hori.add(x)
		hl += 1
	if y not in ver:
		ver.add(y)
		vl += 1
	ct = hl * n + vl * n - hl * vl
	print(n * n - ct, end=' ')
	m -= 1


(n, m) = list(map(int, input().split(' ')))
rowset = set()
colset = set()
ans = []
for i in range(m):
	(a, b) = [int(x) for x in input().split(' ')]
	rowset.add(a)
	colset.add(b)
	ans.append((n - len(rowset)) * (n - len(colset)))
print(' '.join(map(str, ans)))


(n, m) = map(int, input().split())
temp = m
row = set()
col = set()
while temp > 0:
	(x, y) = map(int, input().split())
	row.add(x)
	col.add(y)
	temp -= 1
	booked = len(row) * n + len(col) * n - len(row) * len(col)
	empty = n * n - booked
	print(empty, end=' ')


a = input().split()
a1 = int(a[0])
a2 = int(a[1])
li1 = set()
li2 = set()
out = ''
for i in range(a2):
	b = input().split()
	li1.add(b[0])
	li2.add(b[1])
	rest = (a1 - len(li1)) * (a1 - len(li2))
	out += str(rest) + ' '
print(out)


(n, m) = map(int, input().split())
set_x = set()
set_y = set()
free_cells = [0]
free_cells[0] = n * n
for i in range(m):
	(x, y) = map(int, input().split())
	set_x.add(x)
	set_y.add(y)
	print((n - len(set_x)) * (n - len(set_y)), end=' ')


def funcao(lista, n):
	livres = n * n
	linE = set()
	colE = set()
	res = []
	for torre in lista:
		if torre[0] in linE and torre[1] not in colE:
			livres = livres - (n - len(linE))
			colE.add(torre[1])
		elif torre[0] not in linE and torre[1] in colE:
			livres = livres - (n - len(colE))
			linE.add(torre[0])
		elif torre[0] not in linE and torre[1] not in colE:
			livres = livres - (n - len(colE)) - (n - len(linE)) + 1
			colE.add(torre[1])
			linE.add(torre[0])
		else:
			pass
		res.append(str(livres))
	return res
entrada = input().split()
n = int(entrada[0])
m = int(entrada[1])
lista = []
i = 0
while i < m:
	lista.append(list(map(int, input().split())))
	i += 1
print(' '.join(funcao(lista, n)))


(n, m) = map(int, input().strip().split())
not_attacked = n * n
x = set()
y = set()
ans = []
for i in range(m):
	(xi, yi) = map(int, input().strip().split())
	if xi not in x and yi not in y:
		not_attacked -= n - len(x)
		not_attacked -= n - len(y)
		not_attacked += 1
		x.add(xi)
		y.add(yi)
	elif xi not in x:
		not_attacked -= n - len(y)
		x.add(xi)
	elif yi not in y:
		not_attacked -= n - len(x)
		y.add(yi)
	ans.append(not_attacked)
print(*ans)


temp = input().split()
n = int(temp[0])
m = int(temp[1])
loc = []
S = n * n
r = {}
rc = 0
c = {}
cc = 0
Sarr = []
for i in range(m):
	temp = input().split()
	loc.append([int(temp[0]), int(temp[1])])
	r[int(temp[0])] = False
	c[int(temp[1])] = False
for i in range(m):
	x = loc[i][0]
	y = loc[i][1]
	if r[x] and c[y]:
		Sarr.append(S)
	elif r[x]:
		c[y] = True
		S -= n - rc
		cc += 1
		Sarr.append(S)
	elif c[y]:
		r[x] = True
		S -= n - cc
		rc += 1
		Sarr.append(S)
	else:
		r[x] = True
		c[y] = True
		S -= 2 * n - 1 - rc - cc
		Sarr.append(S)
		cc += 1
		rc += 1
for i in range(m):
	print('%d ' % Sarr[i], end='')


(n, m) = map(int, input().split())
refer0 = dict()
refer1 = dict()
result = list()
size0 = size1 = 0
for i in range(m):
	(a, b) = map(int, input().split())
	if refer0.setdefault(a, 1) > 0:
		size0 += 1
		refer0[a] = 0
	if refer1.setdefault(b, 1) > 0:
		size1 += 1
		refer1[b] = 0
	result.append(str((n - size0) * (n - size1)))
print(' '.join(result))


(n, r) = [int(p) for p in input().split()]
cord = []
final = []
covers = 0
x = set()
y = set()
for _ in range(r):
	(xi, yi) = [int(p) for p in input().split()]
	x.add(xi)
	y.add(yi)
	underAttack = len(x) * n + len(y) * n - len(x) * len(y)
	final.append(n ** 2 - underAttack)
print(*final)


dx = {}
dy = {}
(n, m) = map(int, input().split())
for i in range(m):
	(x, y) = map(int, input().split())
	dx[x] = 1
	dy[y] = 1
	print((n - len(dx)) * (n - len(dy)), end=' ')


def inp(n):
	if n == 1:
		return map(int, stdin.readline().split())
	elif n == 2:
		return map(float, stdin.readline().split())
	else:
		return map(str, stdin.readline().split())
from sys import *
from collections import defaultdict
(row, col) = (defaultdict(int), defaultdict(int))
(n, m) = inp(1)
(ans, r1, c1) = (n * n, n, n)
for i in range(m):
	(r, c) = inp(1)
	if row[r] == 0:
		ans -= c1
		r1 -= 1
		row[r] += 1
	if col[c] == 0:
		ans -= r1
		c1 -= 1
		col[c] += 1
	print(ans, end=' ')


(r, c) = (set(), set())
(n, m) = map(int, input().split())
for _ in range(m):
	(x, y) = map(int, input().split())
	r.add(x)
	c.add(y)
	print(n * n - (len(r) * n + len(c) * n - len(r) * len(c)), end=' ')


def main():
	num = []
	while True:
		try:
			line = input()
			for x in line.split():
				num.append(int(x))
		except:
			break
	n = num[0]
	m = num[1]
	n_avail = [n * n]
	v_col = set()
	v_row = set()
	i = 2
	while i <= 2 * m:
		col = num[i]
		row = num[i + 1]
		safe = n_avail[-1]
		if col in v_col and row in v_row:
			n_avail.append(safe)
		elif col in v_col:
			n_avail.append(safe - (n - len(v_col)))
		elif row in v_row:
			n_avail.append(safe - (n - len(v_row)))
		else:
			n_avail.append(safe - (2 * n - len(v_row) - len(v_col) - 1))
		v_col.add(col)
		v_row.add(row)
		i += 2
	for val in n_avail[1:]:
		print(val, end=' ')
main()


tempInput = input()
tempArr = tempInput.split()
tableSize = int(tempArr[0])
pointCount = int(tempArr[1])
rowSet = set()
columnSet = set()
resultArr = []
index = 0
while index < pointCount:
	locationStr = input()
	locationArr = locationStr.split()
	if index >= 1:
		lastResult = int(resultArr[-1])
		influenceColumn = 0
		if locationArr[0] in rowSet:
			influenceColumn = 0
		else:
			influenceColumn = tableSize - len(columnSet)
		influenceRow = 0
		if locationArr[1] in columnSet:
			influenceRow = 0
		else:
			influenceRow = tableSize - len(rowSet)
		tempResult = influenceColumn + influenceRow
		if locationArr[0] not in rowSet and locationArr[1] not in columnSet:
			tempResult -= 1
		remaindCell = lastResult - tempResult
		resultArr.append(str(remaindCell))
	else:
		remaindCell = (tableSize - 1) * (tableSize - 1)
		resultArr.append(str(remaindCell))
	rowSet.add(locationArr[0])
	columnSet.add(locationArr[1])
	index += 1
resultStr = ' '.join(resultArr)
print(resultStr)


(n, m) = input().split(' ')
(n, m) = (int(n), int(m))
squares = n ** 2
(rows, cols) = (set(), set())
ans = []
under_attack = 0
for i in range(m):
	(r, c) = input().split(' ')
	(r, c) = (int(r), int(c))
	if r not in rows:
		under_attack += n - len(cols)
		rows.add(r)
	if c not in cols:
		under_attack += n - len(rows)
		cols.add(c)
	ans.append(str(squares - under_attack))
print(' '.join(ans))


(n, m) = map(int, input().split())
(sx, sy) = (set(), set())
for _ in range(m):
	(x, y) = map(int, input().split())
	sx.add(x)
	sy.add(y)
	(sxl, syl) = (len(sx), len(sy))
	cnt = sxl * n + syl * n - sxl * syl
	print(n * n - cnt, end=' ')


(board_size, rooks) = map(int, input().split())
valid_squares = board_size ** 2
row_set = set()
col_set = set()
soln = []
for i in range(rooks):
	(row, col) = map(int, input().split())
	if row not in row_set and col not in col_set:
		valid_squares -= 2 * board_size - len(row_set) - len(col_set) - 1
	elif row not in row_set:
		valid_squares -= board_size - len(col_set)
	elif col not in col_set:
		valid_squares -= board_size - len(row_set)
	row_set.add(row)
	col_set.add(col)
	soln.append(valid_squares)
print(*soln)


(n, m) = map(int, input().split())
sum = n ** 2
colx = n
coly = n
usedx = [False] * n
usedy = [False] * n
for i in range(m):
	(x, y) = map(int, input().split())
	x -= 1
	y -= 1
	if not usedx[x]:
		sum -= coly
		usedx[x] = True
		colx -= 1
	if not usedy[y]:
		sum -= colx
		usedy[y] = True
		coly -= 1
	print(sum, end=' ')


(n, m) = map(int, input().split())
x = set()
y = set()
l = n * n
for i in range(m):
	(a, b) = map(int, input().split())
	if b in y:
		if not a in x:
			l += len(y) - n
			x.add(a)
	else:
		if a in x:
			l += len(x) - n
		else:
			l += 1 - 2 * n + len(x) + len(y)
			x.add(a)
		y.add(b)
	print(l, end=' ')


(n, m) = map(int, input().split())
col = []
row = []
sq = n * n
for i in range(n):
	col.append(0)
	row.append(0)
pr = []
kc = 0
kr = 0
for i in range(m):
	(r, c) = map(int, input().split())
	r -= 1
	c -= 1
	if col[c] == 0:
		sq = sq - n + kr
		col[c] = 1
		kc += 1
	if row[r] == 0:
		sq = sq - n + kc
		row[r] = 1
		kr += 1
	pr.append(sq)
print(*pr)


(n, m) = map(int, input().split())
Z = []
nua = n * n
(xseen, yseen) = (set(), set())
for _ in range(m):
	(x, y) = map(int, input().split())
	if x not in xseen:
		nua -= n - len(yseen)
		xseen.add(x)
	if y not in yseen:
		nua -= n - len(xseen)
		yseen.add(y)
	Z.append(nua)
print(' '.join(map(str, Z)))


def chessboard(n, m, a):
	row = [False] * (n + 1)
	col = [False] * (n + 1)
	remain_row = n
	remain_col = n
	ans = []
	for i in range(0, m):
		if row[a[i][0]] == False:
			row[a[i][0]] = True
			remain_row -= 1
		if col[a[i][1]] == False:
			col[a[i][1]] = True
			remain_col -= 1
		ans.append(remain_row * remain_col)
	print(*ans)
line_1 = list(map(int, input().split()))
n = line_1[0]
m = line_1[1]
a = []
for i in range(0, m):
	tmp = list(map(int, input().split()))
	a.append(tmp)
chessboard(n, m, a)