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;
const int maxn = 1300005;
const int maxc = 18;
int R[maxn], L[maxn], U[maxn], D[maxn], Row[maxn];
int S[maxc];
int Col[maxn];
int deep, ans[maxn];
string s1[20], s2[20];
int aa[20], bb[20], n, m;
void remove(int &c) {
  L[R[c]] = L[c];
  R[L[c]] = R[c];
  for (int i = D[c]; i != c; i = D[i]) {
    for (int j = R[i]; j != i; j = R[j]) {
      U[D[j]] = U[j];
      D[U[j]] = D[j];
      S[Col[j]]--;
    }
  }
}
void resume(int &c) {
  for (int i = U[c]; i != c; i = U[i]) {
    for (int j = L[i]; j != i; j = L[j]) {
      ++S[Col[j]];
      U[D[j]] = j;
      D[U[j]] = j;
    }
  }
  L[R[c]] = c;
  R[L[c]] = c;
}
bool dfs() {
  if (R[0] == 0) {
    cout << "YES" << endl;
    for (int i = 0; i < deep; i++) {
      int low = ans[i] % 100;
      int high = ans[i] / 100, nm[20], nmc = 0;
      for (int i = 0; i < n; i++)
        if (high & (1 << i)) nm[nmc++] = i;
      cout << s1[nm[0]];
      for (int i = 1; i < nmc; i++) cout << "+" << s1[nm[i]];
      cout << "->" << s2[low] << endl;
    }
    return true;
  }
  int i, j;
  int idx, minnum = 999999;
  for (i = R[0]; i != 0; i = R[i]) {
    if (S[i] < minnum) {
      minnum = S[i];
      idx = i;
    }
  }
  remove(idx);
  for (i = D[idx]; i != idx; i = D[i]) {
    ans[deep++] = Row[i];
    for (j = R[i]; j != i; j = R[j]) {
      remove(Col[j]);
    }
    if (dfs()) {
      return true;
    }
    deep--;
    for (j = L[i]; j != i; j = L[j]) {
      resume(Col[j]);
    }
  }
  resume(idx);
  return false;
}
void add(int c, int nd) {
  D[U[c]] = nd;
  U[nd] = U[c];
  D[nd] = c;
  U[c] = nd;
  S[c]++;
  Col[nd] = c;
}
map<string, int> mp;
void init() {
  mp["H"] = 1;
  mp["He"] = 2;
  mp["Li"] = 3;
  mp["Be"] = 4;
  mp["B"] = 5;
  mp["C"] = 6;
  mp["N"] = 7;
  mp["O"] = 8;
  mp["F"] = 9;
  mp["Ne"] = 10;
  mp["Na"] = 11;
  mp["Mg"] = 12;
  mp["Al"] = 13;
  mp["Si"] = 14;
  mp["P"] = 15;
  mp["S"] = 16;
  mp["Cl"] = 17;
  mp["Ar"] = 18;
  mp["K"] = 19;
  mp["Ca"] = 20;
  mp["Sc"] = 21;
  mp["Ti"] = 22;
  mp["V"] = 23;
  mp["Cr"] = 24;
  mp["Mn"] = 25;
  mp["Fe"] = 26;
  mp["Co"] = 27;
  mp["Ni"] = 28;
  mp["Cu"] = 29;
  mp["Zn"] = 30;
  mp["Ga"] = 31;
  mp["Ge"] = 32;
  mp["As"] = 33;
  mp["Se"] = 34;
  mp["Br"] = 35;
  mp["Kr"] = 36;
  mp["Rb"] = 37;
  mp["Sr"] = 38;
  mp["Y"] = 39;
  mp["Zr"] = 40;
  mp["Nb"] = 41;
  mp["Mo"] = 42;
  mp["Tc"] = 43;
  mp["Ru"] = 44;
  mp["Rh"] = 45;
  mp["Pd"] = 46;
  mp["Ag"] = 47;
  mp["Cd"] = 48;
  mp["In"] = 49;
  mp["Sn"] = 50;
  mp["Sb"] = 51;
  mp["Te"] = 52;
  mp["I"] = 53;
  mp["Xe"] = 54;
  mp["Cs"] = 55;
  mp["Ba"] = 56;
  mp["La"] = 57;
  mp["Ce"] = 58;
  mp["Pr"] = 59;
  mp["Nd"] = 60;
  mp["Pm"] = 61;
  mp["Sm"] = 62;
  mp["Eu"] = 63;
  mp["Gd"] = 64;
  mp["Tb"] = 65;
  mp["Dy"] = 66;
  mp["Ho"] = 67;
  mp["Er"] = 68;
  mp["Tm"] = 69;
  mp["Yb"] = 70;
  mp["Lu"] = 71;
  mp["Hf"] = 72;
  mp["Ta"] = 73;
  mp["W"] = 74;
  mp["Re"] = 75;
  mp["Os"] = 76;
  mp["Ir"] = 77;
  mp["Pt"] = 78;
  mp["Au"] = 79;
  mp["Hg"] = 80;
  mp["Tl"] = 81;
  mp["Pb"] = 82;
  mp["Bi"] = 83;
  mp["Po"] = 84;
  mp["At"] = 85;
  mp["Rn"] = 86;
  mp["Fr"] = 87;
  mp["Ra"] = 88;
  mp["Ac"] = 89;
  mp["Th"] = 90;
  mp["Pa"] = 91;
  mp["U"] = 92;
  mp["Np"] = 93;
  mp["Pu"] = 94;
  mp["Am"] = 95;
  mp["Cm"] = 96;
  mp["Bk"] = 97;
  mp["Cf"] = 98;
  mp["Es"] = 99;
  mp["Fm"] = 100;
}
int main() {
  init();
  while (cin >> n >> m) {
    deep = 0;
    for (int i = 0; i < n; i++) {
      cin >> s1[i];
      aa[i] = mp[s1[i]];
    }
    for (int i = 0; i < m; i++) {
      cin >> s2[i];
      bb[i] = mp[s2[i]];
    }
    int cnt;
    for (cnt = 0; cnt <= n + m; cnt++) {
      L[cnt] = cnt - 1;
      R[cnt] = cnt + 1;
      U[cnt] = D[cnt] = cnt;
      Col[cnt] = 0;
    }
    cnt = L[0] = n + m;
    R[n + m] = 0;
    int tad[20], tcnt, tsm;
    for (int t = 0; t < m; t++)
      for (int i = 1; i < (1 << n); i++) {
        tcnt = tsm = 0;
        for (int j = 0; j < n; j++)
          if (i & (1 << j)) {
            tsm += aa[j];
            tad[tcnt++] = j;
          }
        if (tsm == bb[t]) {
          for (int u = cnt + 1; u <= cnt + tcnt + 1; u++) {
            L[u] = u - 1;
            R[u] = u + 1;
            Row[u] = t + i * 100;
          }
          L[cnt + 1] = cnt + tcnt + 1;
          R[cnt + tcnt + 1] = cnt + 1;
          for (int k = 1; k <= tcnt; k++) {
            add(tad[k - 1] + 1, cnt + k);
          }
          add(n + t + 1, cnt + tcnt + 1);
          cnt += tcnt + 1;
        }
      }
    deep = 0;
    if (!dfs()) cout << "NO" << endl;
  }
  return 0;
}