National Olympiad in Informatics, China, 2005
The wisdom beads game set consists of a triangular board and

Figure 1
The
For the 1st major category, there are
The symbol is
For the 2nd major category, there are
The symbol is
The symbol is
The symbol is
For the 3rd major category, there are
The symbol is
The symbol is
The symbol is
The symbol is
The symbol is
The symbol is
The symbol is
The symbol is

Figure 2
Figure 2 depicts one method of piecing together the game board. The depiction in Figure 2 can be simplified to Figure 3, so the board can be expressed as a two-dimensional array of characters.
Copy
|
Figure 3 |
A piece may be placed at any location on the board, provided that there is
room to place it, and that the dimensions are appropriate. Rotations
(
Given the initial setup of a game board, determine a valid method for placing all of the remaining pieces onto the board.
Input Specification
The input contains a total of A
to L
, then that means row .
, then that means
row
Output Specification
If it's possible to find a solution, print
If there's no solution, output a single line with the string No
solution
.
The data guarantees that there will be at most one solution for each
test case.
Sample Input
.
..
...
....
.....
.....C
...CCC.
EEEHH...
E.HHH....
E.........
Sample Output
B
BK
BKK
BJKK
JJJDD
GJGDDC
GGGCCCI
EEEHHIIA
ELHHHIAAF
ELLLLIFFFF
Problem translated to English by .
Comments