Description
Description
This will be a useful tool for you to solve block puzzles!
There will be 12 test cases: 10 for basic requirements and 2 for bonus.
You will receive several lines:
First line will have a number, which is the number of pieces. From next line, they are pairs of piece information.
First line of each pair show the "exact" width and height of the piece (No need to handle pathetic pieces!), and then following is the shape of the corresponding piece, which consist of English char, Big 'O' and minus.
After the piece information, you will get several puzzle map information. First line will also have a number, which is the number of puzzle maps. From next line, they are pairs of puzzle map information, which have the same way mentioned above to consist.
Bonus(Only the last two of the testing data bave these cases):
Rotating and flipping the pieces are allowed.
Input
3
4 2
OOOO
-O--
2 3
O-
OO
OO
3 3
-OO
OO-
O--
2
4 6
----
--OO
--OO
----
O--O
O-OO
5 4
-----
O----
O--O-
OO---
Output
Yes
No