시간 제한메모리 제한제출정답맞은 사람정답 비율
1.5 초 256 MB0000.000%

문제

When Rikka was playing PUBG (PlayerUnknown's Battlegrounds), she could not win the game. So she decided to use some techniques this time. With the techniques, now Rikka can see clearly where all players are in the game.

In the game, the map can be denoted as a grid of size $n \times m$. Rikka uses software that can rate the enemy's combat value based on their performance. Now, there is exactly one enemy in each square, and all enemies' combat values form a permutation of integers from $1$ to $n \cdot m$. Since Rikka is quite a green hand, she always cares about the weakest enemies (the less the enemy's combat value is, the weaker the enemy is).

We denote the square at row $i$, column $j$ as $(i,j)$. A subgrid can be defined by $((x_1,y_1), (x_2,y_2))$, where $1 \le x_1 \le x_2 \le n$ and $1 \le y_1 \le y_2 \le m$, and the subgrid itself is the squares $(x, y)$ for which $x_1 \le x \le x_2$ and $y_1 \le y \le y_2$. Two subgrids $((x_1,y_1), (x_2,y_2))$ and $((x_1',y_1'), (x_2',y_2'))$ are the same if and only if $((x_1,y_1),(x_2,y_2)) = ((x_1',y_1'),(x_2',y_2'))$.

For now, Rikka wants to know how many subgrids are there such that the weakest enemy's combat value in them is equal to $x$. Help her find the answers for all $x = 1, 2, \ldots, n \cdot m$.

입력

The first line of input contains two integers $n$ and $m$ ($1 \le n, m \le 300$).

Then follow $n$ lines. The $i$-th of them contains $m$ integers, where the $j$-th integer is the combat value of the enemy in $(i, j)$. It is guaranteed that the values form a permutation of integers from $1$ to $n \cdot m$.

출력

Print $n \cdot m$ lines, with one integer on each line.

The integer on the $i$-th line is the answer for $x = i$.

예제 입력 1

2 3
2 5 1
6 3 4

예제 출력 1

6
4
5
1
1
1