#abc268d. [abc268_d]Unique Username

[abc268_d]Unique Username

Problem Statement

Takahashi is having trouble with deciding a username for a service. Write a code to help him.

Find a string XX that satisfies all of the following conditions:

  • XX is obtained by the following procedure:
    • Let S1,S2,ldots,SNS_1', S_2', \\ldots,S_N' be a permutation of S1,S2,ldots,SNS_1, S_2, \\ldots,S_N. Let XX be the concatenation of S1S_1', (11 or more copies of _), S2S_2', (11 or more copies of _), ldots\\ldots, (11 or more copies of _), and SNS_N', in this order.
  • The length of XX is between 33 and 1616, inclusive.
  • XX does not coincide with any of MM strings T1,T2,ldots,TMT_1,T_2,\\ldots,T_M.

If there is no XX that satisfies all of the conditions, print -1 instead.

Constraints

  • 1leqNleq81 \\leq N \\leq 8
  • 0leqMleq1050 \\leq M \\leq 10^5
  • NN and MM are integers.
  • 1leqSileq161 \\leq |S_i| \\leq 16
  • N1+sumSileq16N-1+\\sum{|S_i|} \\leq 16
  • SineqSjS_i \\neq S_j if ineqji \\neq j.
  • SiS_i is a string consisting of lowercase English letters.
  • 3leqTileq163 \\leq |T_i| \\leq 16
  • TineqTjT_i \\neq T_j if ineqji \\neq j.
  • TiT_i is a string consisting of lowercase English letters and _.

Input

Input is given from Standard Input in the following format:

NN MM S1S_1 S2S_2 vdots\\vdots SNS_N T1T_1 T2T_2 vdots\\vdots TMT_M

Output

Print a string XX that satisfies all of the conditions. If there is no XX that satisfies all of the conditions, print -1 instead.
If there are multiple solutions, print any of them.


Sample Input 1

1 1
chokudai
chokudai

Sample Output 1

-1

The only string that satisfies the first and second conditions is X=X= chokudai, but it coincides with T1T_1.
Thus, there is no XX that satisfies all of the conditions, so -1 should be printed.


Sample Input 2

2 2
choku
dai
chokudai
choku_dai

Sample Output 2

dai_choku

Strings like choku__dai (which has two _'s between choku and dai) also satisfy all of the conditions.


Sample Input 3

2 2
chokudai
atcoder
chokudai_atcoder
atcoder_chokudai

Sample Output 3

-1

chokudai__atcoder and atcoder__chokudai (which have two _'s between chokudai and atcoder) have a length of 1717, which violates the second condition.


Sample Input 4

4 4
ab
cd
ef
gh
hoge
fuga
____
_ab_cd_ef_gh_

Sample Output 4

ab__ef___cd_gh

The given TiT_i may contain a string that cannot be obtained by the procedure described in the first condition.