You are given an integer N denoting an N×N matrix. Initially, each cell of the matrix is empty. You are given K tasks. In each task, you are given a cell (i,j) where cell (i,j) represents the ith row and jth column of the given matrix.
You have to perform each task sequentially in the given order. Each task is described in cell (i,j). For each task, you have to place X in each cell of row i and each cell column j. After you complete each task, you are required to print the number of empty cells in the matrix.
Input format
Output format
Print K space-separated integers denoting the number of empty cells in the matrix.
Constraints
1≤N≤105
1≤K≤1000
1≤i,j≤N
Initally all the cells [{1, 1}, {1, 2}, {1, 3}, {2, 1}, {2, 2}, {2, 3}, {3, 1}, {3, 2}, {3, 3}] are empty.
After the first task:
Empty cells are [{2, 2}, {2, 3}, {3, 2}, {3, 3}]. Therefore, the answer is 4.
After the second task:
Empty cells are [{2, 2}, {3, 2}]. Therefore, the answer is 2.
After the third task:
No cells remain empty. Therefore, the answer is 0.