Careful Declaration

No attempts yetTime limit2sMemory limit128 MB

Problem

"Do not panic!" is not only the famous inscription on a book cover — it is also the message every bank must convey to its clients during any crisis, however small. If clients begin to panic, it can spell the end of a bank.

To reassure their clients, banks and governments issue declarations stating that there is nothing to worry about. For people to believe them, these declarations must be consistent with one another.

Suppose we have two declarations: one proposed by a bank and one by the government. They decide to merge the two into a single joint declaration and issue it together (too many separate declarations might itself look like a sign of trouble). Both parties insist that the combined declaration contain the entire text of their own original declaration.

Your task is to produce the joint declaration to be issued tonight. The result must contain every word of both original declarations in their original order, and it must be as short as possible.

Input

The input contains several test cases. Each test case consists of two lines of text giving the two original declarations. Each line contains at least $1$ and at most $2000$ words separated by single spaces. Every word consists of lowercase English letters (az), with at least $1$ and at most $10$ letters. After the last word of each declaration there is a single dot (.), preceded by one space.

A final line containing a single dot (.) follows the last test case.

Output

For each test case, output a single line containing a sequence of words separated by single spaces, with the following properties:

  1. Both input declarations are subsequences of the output — every word of each original declaration appears in the result in the same order, though the two may be interleaved with each other.
  2. Among all texts satisfying property 1, the output contains the fewest possible words.
  3. If several texts share that minimum length, output the lexicographically smallest one.

After the last word, print a space and a single dot (.).

A text A is lexicographically smaller than a text B if it would come first in a dictionary: at the first position where the two texts differ, the word in A is lexicographically smaller than the word in B.

A word C is lexicographically smaller than a word D if either (a) at the first letter where they differ, C's letter comes earlier in the alphabet, or (b) C is shorter than D and is a prefix of D.