With plenty of free time on their hands (or rather, hooves), the cows on Farmer John's farm often pass the time by playing video games. One of their favorites is based on a popular human video game called Puyo Puyo; the cow version is, of course, called Mooyo Mooyo.
Mooyo Mooyo is played on a tall, narrow grid that is cells tall and cells wide. Here is an example with n = 6:
0000000000
0000000300
0054000300
1054502230
2211122220
1111111223Each cell is either empty (denoted by ) or contains a haybale of one of nine colors (denoted by the digits to ). Gravity makes haybales fall downward, so there is never an empty cell below a haybale.
Two cells belong to the same connected region if they are adjacent horizontally or vertically and have the same nonzero color. Whenever a connected region of at least cells exists, all of its haybales disappear and the cells become empty. If several such regions exist at the same time, they all disappear simultaneously. After that, gravity may cause haybales to fall down into some of the newly emptied cells. The resulting configuration may again contain connected regions of at least cells. If so, they also disappear (simultaneously, if there are several), gravity again pulls the remaining haybales down, and the process repeats until no connected region of at least cells remains.
Given the initial state of a Mooyo Mooyo board, print the final state of the board after all these operations.
The first line contains two integers and k~(1 \le n \le 100, 1 \le k \le 10n). Each of the next lines contains digits and describes one row of the initial board.
Print lines describing the final state of the board in the same format.
In the example above, if k = 3, there is a connected region of at least cells of color and another one of color . After they are removed simultaneously, the board temporarily looks like this:
0000000000
0000000300
0054000300
1054500030
2200000000
0000000003Then gravity takes effect, and the haybales fall into the following configuration:
0000000000
0000000000
0000000000
0000000000
1054000300
2254500333Again, there is a region of at least cells (of color ). Removing it yields the final configuration of the board:
0000000000
0000000000
0000000000
0000000000
1054000000
2254500000Example 1