Problem: There is the following puzzle popular among nuclear physicists.

A reactor contains a set of n atoms of some chemical elements. We shall understand the phrase "atomic number" as the number of this atom's element in the periodic table of the chemical elements.

You are allowed to take any two different atoms and fuse a new one from them. That results in a new atom, whose number is equal to the sum of the numbers of original atoms. The fusion operation can be performed several times.

The aim is getting a new pregiven set of k atoms.

The puzzle's difficulty is that it is only allowed to fuse two atoms into one, it is not allowed to split an atom into several atoms. You are suggested to try to solve the puzzle.

Input

The first line contains two integers n and k (1 ≤ k ≤ n ≤ 17). The second line contains space-separated symbols of elements of n atoms, which are available from the start. The third line contains space-separated symbols of elements of k atoms which need to be the result of the fusion. The symbols of the elements coincide with the symbols from the periodic table of the chemical elements. The atomic numbers do not exceed 100 (elements possessing larger numbers are highly unstable). Some atoms can have identical numbers (that is, there can be several atoms of the same element). The sum of numbers of initial atoms is equal to the sum of numbers of the atoms that need to be synthesized.

Output

If it is impossible to synthesize the required atoms, print "NO" without the quotes. Otherwise, print on the first line «YES», and on the next k lines print the way of synthesizing each of k atoms as equations. Each equation has the following form: "x1+x2+...+xt->yi", where xj is the symbol of the element of some atom from the original set, and yi is the symbol of the element of some atom from the resulting set. Each atom from the input data should occur in the output data exactly one time. The order of summands in the equations, as well as the output order does not matter. If there are several solutions, print any of them. For a better understanding of the output format, see the samples.

Examples

Input

10 3
Mn Co Li Mg C P F Zn Sc K
Sn Pt Y


Output

YES
Mn+C+K-&gt;Sn
Co+Zn+Sc-&gt;Pt
Li+Mg+P+F-&gt;Y


Input

2 1
H H
He


Output

YES
H+H-&gt;He


Input

2 2
Bk Fm
Cf Es


Output

NO

Note

The reactions from the first example possess the following form (the atomic number is written below and to the left of the element):

<image>

<image>

<image>

To find a periodic table of the chemical elements, you may use your favorite search engine.

The pretest set contains each of the first 100 elements of the periodic table at least once. You can use that information to check for misprints.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int n, m, x[20], y[20], state, s[1 << 17], h[105], t[1 << 17][2], w,
    f[20][1 << 17], out[20];
char r1[20][5], r2[20][5];
bool b[105], dp[20][1 << 17];
int ref(char *s) {
  if (strcmp(s, "H") == 0) return 1;
  if (strcmp(s, "He") == 0) return 2;
  if (strcmp(s, "Li") == 0) return 3;
  if (strcmp(s, "Be") == 0) return 4;
  if (strcmp(s, "B") == 0) return 5;
  if (strcmp(s, "C") == 0) return 6;
  if (strcmp(s, "N") == 0) return 7;
  if (strcmp(s, "O") == 0) return 8;
  if (strcmp(s, "F") == 0) return 9;
  if (strcmp(s, "Ne") == 0) return 10;
  if (strcmp(s, "Na") == 0) return 11;
  if (strcmp(s, "Mg") == 0) return 12;
  if (strcmp(s, "Al") == 0) return 13;
  if (strcmp(s, "Si") == 0) return 14;
  if (strcmp(s, "P") == 0) return 15;
  if (strcmp(s, "S") == 0) return 16;
  if (strcmp(s, "Cl") == 0) return 17;
  if (strcmp(s, "Ar") == 0) return 18;
  if (strcmp(s, "K") == 0) return 19;
  if (strcmp(s, "Ca") == 0) return 20;
  if (strcmp(s, "Sc") == 0) return 21;
  if (strcmp(s, "Ti") == 0) return 22;
  if (strcmp(s, "V") == 0) return 23;
  if (strcmp(s, "Cr") == 0) return 24;
  if (strcmp(s, "Mn") == 0) return 25;
  if (strcmp(s, "Fe") == 0) return 26;
  if (strcmp(s, "Co") == 0) return 27;
  if (strcmp(s, "Ni") == 0) return 28;
  if (strcmp(s, "Cu") == 0) return 29;
  if (strcmp(s, "Zn") == 0) return 30;
  if (strcmp(s, "Ga") == 0) return 31;
  if (strcmp(s, "Ge") == 0) return 32;
  if (strcmp(s, "As") == 0) return 33;
  if (strcmp(s, "Se") == 0) return 34;
  if (strcmp(s, "Br") == 0) return 35;
  if (strcmp(s, "Kr") == 0) return 36;
  if (strcmp(s, "Rb") == 0) return 37;
  if (strcmp(s, "Sr") == 0) return 38;
  if (strcmp(s, "Y") == 0) return 39;
  if (strcmp(s, "Zr") == 0) return 40;
  if (strcmp(s, "Nb") == 0) return 41;
  if (strcmp(s, "Mo") == 0) return 42;
  if (strcmp(s, "Tc") == 0) return 43;
  if (strcmp(s, "Ru") == 0) return 44;
  if (strcmp(s, "Rh") == 0) return 45;
  if (strcmp(s, "Pd") == 0) return 46;
  if (strcmp(s, "Ag") == 0) return 47;
  if (strcmp(s, "Cd") == 0) return 48;
  if (strcmp(s, "In") == 0) return 49;
  if (strcmp(s, "Sn") == 0) return 50;
  if (strcmp(s, "Sb") == 0) return 51;
  if (strcmp(s, "Te") == 0) return 52;
  if (strcmp(s, "I") == 0) return 53;
  if (strcmp(s, "Xe") == 0) return 54;
  if (strcmp(s, "Cs") == 0) return 55;
  if (strcmp(s, "Ba") == 0) return 56;
  if (strcmp(s, "La") == 0) return 57;
  if (strcmp(s, "Ce") == 0) return 58;
  if (strcmp(s, "Pr") == 0) return 59;
  if (strcmp(s, "Nd") == 0) return 60;
  if (strcmp(s, "Pm") == 0) return 61;
  if (strcmp(s, "Sm") == 0) return 62;
  if (strcmp(s, "Eu") == 0) return 63;
  if (strcmp(s, "Gd") == 0) return 64;
  if (strcmp(s, "Tb") == 0) return 65;
  if (strcmp(s, "Dy") == 0) return 66;
  if (strcmp(s, "Ho") == 0) return 67;
  if (strcmp(s, "Er") == 0) return 68;
  if (strcmp(s, "Tm") == 0) return 69;
  if (strcmp(s, "Yb") == 0) return 70;
  if (strcmp(s, "Lu") == 0) return 71;
  if (strcmp(s, "Hf") == 0) return 72;
  if (strcmp(s, "Ta") == 0) return 73;
  if (strcmp(s, "W") == 0) return 74;
  if (strcmp(s, "Re") == 0) return 75;
  if (strcmp(s, "Os") == 0) return 76;
  if (strcmp(s, "Ir") == 0) return 77;
  if (strcmp(s, "Pt") == 0) return 78;
  if (strcmp(s, "Au") == 0) return 79;
  if (strcmp(s, "Hg") == 0) return 80;
  if (strcmp(s, "Tl") == 0) return 81;
  if (strcmp(s, "Pb") == 0) return 82;
  if (strcmp(s, "Bi") == 0) return 83;
  if (strcmp(s, "Po") == 0) return 84;
  if (strcmp(s, "At") == 0) return 85;
  if (strcmp(s, "Rn") == 0) return 86;
  if (strcmp(s, "Fr") == 0) return 87;
  if (strcmp(s, "Ra") == 0) return 88;
  if (strcmp(s, "Ac") == 0) return 89;
  if (strcmp(s, "Th") == 0) return 90;
  if (strcmp(s, "Pa") == 0) return 91;
  if (strcmp(s, "U") == 0) return 92;
  if (strcmp(s, "Np") == 0) return 93;
  if (strcmp(s, "Pu") == 0) return 94;
  if (strcmp(s, "Am") == 0) return 95;
  if (strcmp(s, "Cm") == 0) return 96;
  if (strcmp(s, "Bk") == 0) return 97;
  if (strcmp(s, "Cf") == 0) return 98;
  if (strcmp(s, "Es") == 0) return 99;
  if (strcmp(s, "Fm") == 0) return 100;
}
void adde(int x, int y) {
  t[w][0] = y;
  t[w][1] = h[x];
  h[x] = w++;
}
void output() {
  for (int i = 0; i < state; i++) {
    if (dp[m - 1][i]) {
      printf("YES\n");
      for (int j = m - 1; j >= 0; j--) {
        out[j] = f[j][i];
        i ^= f[j][i];
      }
      for (int j = 0; j < m; j++) {
        for (int k = 0; k < n; k++) {
          if (out[j] & (1 << k)) {
            printf("%s", r1[k]);
            out[j] ^= 1 << k;
            if (out[j]) {
              printf("+");
            }
          }
        }
        printf("->%s\n", r2[j]);
      }
      return;
    }
  }
  printf("NO\n");
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", r1[i]);
    x[i] = ref(r1[i]);
  }
  for (int i = 0; i <= 100; i++) {
    b[i] = false;
  }
  for (int i = 0; i < m; i++) {
    scanf("%s", r2[i]);
    y[i] = ref(r2[i]);
    b[y[i]] = true;
  }
  for (int i = 0; i <= 100; i++) {
    h[i] = -1;
  }
  w = 0;
  state = (1 << n);
  s[0] = 0;
  for (int i = 1; i < state; i++) {
    for (int j = 0;; j++) {
      if (i & (1 << j)) {
        s[i] = s[i ^ (1 << j)] + x[j];
        if ((s[i] <= 100) && (b[s[i]])) {
          adde(s[i], i);
        }
        break;
      }
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < state; j++) {
      dp[i][j] = false;
    }
  }
  for (int k = h[y[0]]; k != -1; k = t[k][1]) {
    dp[0][(state - 1) ^ t[k][0]] = true;
    f[0][(state - 1) ^ t[k][0]] = t[k][0];
  }
  for (int i = 0; i + 1 < m; i++) {
    for (int j = 0; j < state; j++) {
      if (dp[i][j]) {
        for (int k = h[y[i + 1]]; k != -1; k = t[k][1]) {
          if ((j & t[k][0]) == t[k][0]) {
            dp[i + 1][j ^ t[k][0]] = true;
            f[i + 1][j ^ t[k][0]] = t[k][0];
          }
        }
      }
    }
  }
  output();
  return 0;
}