The first crossword puzzle was published on December 21, 1913 by Arthur Wynne. To celebrate the centennial of his great-great-grandfather's invention, John "Coward" Wynne^1 was struggling to make crossword puzzles. He was such a coward that whenever he thought of a tricky clue for a word, he couldn't stop worrying if people would blame him for choosing a bad clue that could never mean that word. At the end of the day, he cowardly chose boring clues, which made his puzzles less interesting.
One day, he came up with a brilliant idea: puzzles in which word meanings do not matter, and yet interesting. He told his idea to his colleagues, who admitted that the idea was intriguing. They even named his puzzles "Coward's Crossword Puzzles" after his nickname.
However, making a Coward's crossword puzzle was not easy. Even though he did not have to think about word meanings, it was not easy to check if a puzzle has one and only one set of answers. As the day of the centennial anniversary was approaching, John started worrying if he would not be able to make interesting ones in time. Let's help John by writing a program that solves Coward's crossword puzzles.
Each puzzle consists of h \times w cells along with across clues and down clues. The clues are regular expressions written in a pattern language whose BNF syntax is given as in the table below.

Table 1. BNF syntax of the pattern language.
The clues (as denoted by and below) match words (as denoted by below) according to the following rules.
^p$ matches if matches .
p|q matches a string if and/or matches .
pq matches a string if there exist s_1 and s_2 such that s_1s_2 = s, matches s_1, and matches s_2.
p* matches a string if is empty, or there exist s_1 and s_2 such that s_1s_2 = s, matches s_1, and matches s_2.
Each of A, B, , Z matches the respective letter itself.
(p) matches if matches .
. is the shorthand of (A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z).
Below is an example of a Coward's crossword puzzle with the answers filled in the cells.

Java Specific: Submitted Java programs may not use classes in the java.util.regex package.
C++ Specific: Submitted C++ programs may not use the std::regex class.
_________________
^1All characters appearing in this problem, except for Arthur Wynne, are fictitious. Any resemblance to real persons, living or dead, is purely coincidental.
The input consists of multiple datasets, each of which represents a puzzle given in the following format.
p_1
p_2
p_h
q_1
q_2
q_w
Here, and represent the vertical and horizontal numbers of cells, respectively, where 2 \leq h,\ w \leq 4. The p_i and q_j are the across and down clues for the -th row and -th column, respectively. Any clue has no more than characters.
The last dataset is followed by a line of two zeros. You may assume that there are no more than datasets in the input.
For each dataset, when the puzzle has a unique set of answers, output it as lines of characters. When the puzzle has no set of answers, or more than one set of answers, output none or ambiguous without double quotations, respectively.
Example 1