Gap

 

There are many different ways of saying things and also of writing things. Sometimes there are much more different ways of saying things than things that are worth to be said. Sometimes people invent funny ways of telling things, sometimes people find complicated ways of not telling anything. This is true not only of people professionally engaged in the communication business, but also of everyone else. It is hard to communicate (do you see what we mean?).

 

To help you correlate what some people may want to say (or not) you decided to workout a tool that may be used to compare two texts with gaps, and tell whether the patches may be filled so that the resulting texts will become the same. Gaps in the text are named by strings and have a length attached. For example, the sequence of characters <firstname:10> identifies a gap named "firstname" of length 10. Here is an example of texts with gaps (we identify blank spaces in the input with the symbol _ ).

 

<name:3>'s_boat_is_no_longer_than_Anne's._If_Joe_likes

_<food:7>_then_so_do_I._Usually,_<food:7>_are_yellow.

 

<thing:10>_is_no_longer_than_Anne's._If_<name:3>_likes

_bananas_then_so_do_I._Usually,_bananas_are_<color:6>.

 

The texts may be matched by consistently replacing each named gap by some string of the appropriate length. The same named gap may appear in either text, always with the same associated length. In the example above, we may set:

 

color yellow

food bananas

name Joe

thing Joe's boat

 

Your goal is to write a program that given two texts with gaps will determine if the texts can be matched, in which case it must list how to fill the gaps, or not.

Input

The input consists of two texts, in sequence. A text is given as a sequence of printable characters, for convenience split into several lines. Each text is specified by an integer N, in a single line, indicating how many lines the text has, followed by precisely N lines. To obtain the text from its lines, you should just concatenate the contents of all the lines, in order. The text may contain the usual alphabetic and punctuation characters, and also sequences of the form <identifier:integer> indicating a gap in the text. The identifier is a sequence of alphabetic characters, with the name of the gap, and integer is an integer (between 0 and 32), with the length of the gap. Every gap identifier in a gap is always associated to the same integer. The number of lines in each test does not exceed 100 lines, and each line does not exceed 400 characters.

 

Output

If the texts can be matched, the output will contain "yes" in the first line, followed by the strings that have been chosen to fill the gaps. For each gap, you should list the gap identifier, followed by a single space, and the text selected to fill the given gap. This list should appear by alphabetic order of the gap identifiers. If your matching is not able to identify some character precisely, then such character must be printed as "*" in the output.

If the texts cannot be matched, the output should contain "no" in a single line.

 

Sample Input A

2

<name:3>'s_boat_is_no_longer_than_Anne's._If_Joe_likes

_<food:7>_then_so_do_I._Usually,_<food:7>_are_yellow.

2

<thing:10>_is_no_longer_than_Anne's._If_<name:3>_likes

_bananas_then_so_do_I._Usually,_bananas_are_<color:6>.

 

Sample Output A

yes

color yellow

food bananas

name Joe

thing Joe's boat

 

Sample Input B

1

potato<bingo:6>.

1

po<bobo:6> ppp.

 

Sample Output B

yes

bingo ** ppp

bobo tato**