Battleship

No attempts yetTime limit2sMemory limit256 MB

Problem

You work for an information security company. A client recently built a program that decides whether the one using it is a person or another program, and your job is to test how well it works.

The test uses a variant of the board game Battleship. The game runs on a 10×1010 \times 10 grid. Before the game starts you place ten space warships on the grid: four ships that cover one cell, three that cover two cells, two that cover three cells, and one that covers four cells. Each ship takes a run of consecutive cells laid out horizontally or vertically. Two different ships never share a cell, and they never touch, neither side by side nor diagonally.

Once the ships are placed, the test runs for several rounds. In each round you may pick any one cell and fire at it. A ship sinks when every cell it covers has been hit at least once. The game ends once all ten ships have sunk.

The complexity of a game is the number of rounds played until the game ends. You expect a person to make the game more complex than a program does, so you want to know the largest complexity the game can reach.

You have already fixed the order in which you fire, and that order never fires at the same cell twice. Given the order, find the initial state of the grid that makes the complexity as large as possible.

Input

Ten lines contain ten integers each. The cc-th number on the rr-th line tells which round the cell in row rr and column cc is fired at, and it is between 1 and 100.

No cell is fired at twice, so every number from 1 to 100 appears exactly once.

Output

Print the initial state of the grid that makes the complexity as large as possible, on ten lines. Write . for an empty cell and # for a cell that a ship covers.

If several placements reach the largest complexity, print the one whose 100 characters, taken line by line from the top, come first in lexicographic order. When comparing, treat # as coming before ..