Power Game

Jonathan is excited about the new sensation of the moment: the Power Game. This game is played on a grid with NN rows and MM columns, where each cell contains a monster. The monster in row ii and column jj has power Pi,jP_{i,j}.

At the start of the game, Jonathan chooses one of the N×MN \times M monsters to play. The monster chosen by Jonathan becomes the hero of the game and starts the game with the power indicated in its cell. Jonathan can move the hero orthogonally (that is, up, down, right, or left) within the grid as long as the hero is alive. The hero cannot leave the grid, but can visit the same cell multiple times.

Every time the hero enters a cell with a living monster, a battle occurs between the hero and the monster in the cell. The hero wins the battle if, and only if, its power is greater than or equal to the monster's power. Otherwise, the hero dies and the game ends in game over. Every time the hero wins a battle, the defeated monster dies (i.e., the cell no longer contains any monster) and, as a reward, the monster's power is added to the hero's power (i.e., if the hero kills the monster in cell (i,j)(i, j), the hero's power increases by Pi,jP_{i,j}).

Jonathan realized that the game might be unfair: even if he plays optimally, depending on his choice of hero, it might be possible to kill all the monsters, just some, or even none.

Determined to “platinum” the game, Jonathan needs to know the maximum power each hero can reach (i.e., the maximum possible power that can be achieved when starting the game in each cell of the grid) if the game is played optimally. Fortunately, he discovered that the students of OBI (Organization of Good Programmers) recently solved the Game of Life, his third favorite game (after the Power Game and the Racing Game, of course), so he asked for your help again! Determine, for each hero, the maximum power they can reach if Jonathan plays optimally.

Input

The first line of input contains two integers NN and MM, the number of rows and the number of columns of the grid, respectively.

The next NN lines contain MM integers each. The jj-th integer of the ii-th line contains the power Pi,jP_{i,j} of the monster in the ii-th row and jj-th column.

Output

Your program should print NN lines, each containing MM integers. The jj-th integer of the ii-th line should be the maximum power Jonathan can reach if he chooses as the hero the monster from cell (i,j)(i, j) and plays optimally.

Constraints

  • 1N100,0001 \leq N \leq 100,000
  • 1M100,0001 \leq M \leq 100,000
  • 1N×M100,0001 \leq N \times M \leq 100,000
  • 1Pi,j1,000,000,0001 \leq P_{i,j} \leq 1,000,000,000 for all 1iN1 \leq i \leq N and 1jM1 \leq j \leq M

Attention: Note that it is not possible to declare 100,000×100,000100,000 × 100,000 integers (with matrix, vector, etc.) without exceeding the memory limit (this would cause errors in the program as it would attempt to use tens of GB of memory). Pay attention to the limit N×M100,000N × M \leq 100,000, which ensures that the grid will always have at most 100,000 cells.

Input Samples Output Samples
2 3
2 3 9
1 7 200
6 6 22
1 22 222
1 7
6 3 10 1 20 7 7
9 3 54 1 54 14 14
5 6
10 10 10 10 10 10
10 10 1 1 1 10
10 10 10 1 10 10
10 10 10 4 10 10
10 10 10 10 10 2
250 250 250 250 250 250
250 250 8 8 8 250
250 250 250 8 250 250
250 250 250 8 250 250
250 250 250 250 250 2