The Wisdom Beads game board consists of a triangular tray and 12 distinct pieces. The tray is shown in Figure 1.
Figure 1
The 12 pieces are divided into 3 categories based on the number of beads:
Category 1: Contains 3 beads, only 1 shape. Symbol A, shape:
Category 2: Contains 4 beads, 3 shapes. Symbol B, shape: Symbol C, shape: Symbol D, shape:
Category 3: Contains 5 beads, 8 shapes. Symbol E, shape: Symbol F, shape: Symbol G, shape: Symbol H, shape: Symbol I, shape: Symbol J, shape: Symbol K, shape: Symbol L, shape:
Figure 2 shows a completed board configuration. For easier description, Figure 2 can be abstracted into Figure 3, which can be represented by a two-dimensional array of characters.
Figure 2
B B K B K K B J K K J J J D D G J G D D C G G G C C C I E E E H H I I A E L H H H I A A F E L L L L I F F F F
Figure 3
The pieces made of beads can be placed in any position on the board, provided there is space and the dimensions fit. All pieces are allowed to be rotated ($0^\circ, 90^\circ, 180^\circ, 270^\circ$) and flipped (horizontally or vertically).
Given an initial layout of the board, find a valid Wisdom Beads placement scheme such that all pieces are placed into the board.
Input
The input contains the description of the initial board layout, consisting of 10 lines, where the $i$-th line contains $i$ characters. If the $j$-th character of the $i$-th line is one of the letters "A" through "L", it indicates that a piece has already been placed at the $i$-th row and $j$-th column, with the piece identified by the corresponding letter. If the $j$-th character of the $i$-th line is ".", it indicates that the cell at the $i$-th row and $j$-th column is empty.
The input guarantees that the pre-placed pieces are already correctly positioned on the board.
Output
If a solution is found, print 10 lines representing the layout after all 12 pieces have been placed. The $i$-th line should contain $i$ characters, where the $j$-th character of the $i$-th line indicates which piece is placed at the $i$-th row and $j$-th column.
If no solution exists, output the single string No solution (without quotes, case-sensitive). All data is guaranteed to have at most one solution.
Examples
Input 1
. .. ... .... ..... .....C ...CCC. EEEHH... E.HHH.... E.........
Output 1
B BK BKK BJKK JJJDD GJGDDC GGGCCCI EEEHHIIA ELHHHIAAF ELLLLIFFFF