"STRING MATCHING" (ESTONIA)

You are given two collections of strings, collection A and collection B. Your task is to find out if there exists a non-empty string S that is expressible as a concatenation of members of collection A as well as a concatenation of members of collection B. If there is such string, you must find the shortest one. A member of collection may occur multiple times in a concatenation.

Input data

On the first line of file MATCH.IN is integer N (0 £ N £ 100), the number of strings in collection A. On the next N lines are the members of collection A, each on separate line. On the next line is integer M (0 £ M £ 100), the number of strings in collection B. On the next M lines are the members of collection B, each on separate line. All collection members consist of capital Latin letters and have length between 1 and 50 (inclusive).

Output data

Your program must write itís output to file MATCH.OUT. If there is no string S, the program must write 0 (zero) on the first and only line of the file. Otherwise, the first line must contain the length of the shortest possible S. The next line must contain the representation of S as concatenation of strings from collection A. The strings must be output in the order of concatenation and separated by '+' (plus) signs. The next line must contain the representation of the string as concatenation of strings from collection B in the same format as for strings from collection A. If different shortest strings are possible, you must output representation for one of them. If different representations from one collection for shortest string are possible, you must output one of them.

Evaluation

Only absolutely correct answers are accepted - if the reported string is not the shortest possible, the program scores 0 for given test. A solution that fails all tests where string S exists will score 0 for the whole problem.

Example 1
Input data(file MATCH.IN)         Output data (file MATCH.OUT)
1                    0
AB
2
A
BA

Example 2
Input data(file MATCH.IN)         Output data (file MATCH.OUT)
2                    5
ABC                  CB+ABC
CB                   CBA+BC
2
CBA
BC


TEST CASES

NEXT TASK