Pentominos 

A pentomino consists of five equal-sized squares attached edge-to-edge to form some shape. There are twelve possiblepentominos that can be formed in this way (plus their reflections and rotations). A few pentominos are shown below:

            XXXXX           XXXX           XXXX           X
                               X            X            XXX
                                                          X

Something that has been keeping people occupied since the late 50's is to find a way to form a rectangle of a given size using the 12 different pentominos

Input and Output 

Write a program that reads several dataset. The first line of the input contains the number of datasets, followed by a blank line. Each dataset has 4 lines containing two numbers between 1 and 8. These numbers represent 4 different cells in an 8$\times$8 square. Each dataset is separated by a blnk line.

The program must determine if it is possible to cover the remaining 60 cells using the 12 different types of pentominos. The solution may use a given type of pentomino more than once, or not at all. The output from the program will show the square filled with pentominos. Each pentomino in the output must be drawn using a different character from `a' to `l'. The blocked cells should be drawn using the `*' character.

Your program needs to only find one solution. If no solution exists, ``No solution." should be printed.

Print a blank line between datasets.

Sample Input 

1

3 5
4 5
5 5
6 5

Sample Output 

aaaaabcc
deeebbbc
ddde*bcc
ffde*ggg
hffi*ggj
hfii*jjj
hiikkklj
hhkkllll



Miguel Revilla
2000-12-30