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;
vector<int> m1, m2;
vector<string> mas;
map<string, int> M;
vector<vector<int> > G;
int dp[17][1 << 17];
int way[17][1 << 17];
int R(int n, int mask) {
  if (n == m2.size()) return 1;
  if (mask == (1 << m1.size()) - 1) return 0;
  int &r = dp[n][mask];
  if (r != -1) return r;
  for (int i = (0), _b(G[n].size()); i < _b; ++i)
    if ((mask & G[n][i]) == 0) {
      if (R(n + 1, mask | G[n][i]) == 1) {
        way[n][mask] = (n + 1) * (1 << 17) + (mask | G[n][i]);
        return r = 1;
      }
    }
  return r = 0;
}
int main() {
  mas.push_back("-1");
  mas.push_back("H");
  mas.push_back("He");
  mas.push_back("Li");
  mas.push_back("Be");
  mas.push_back("B");
  mas.push_back("C");
  mas.push_back("N");
  mas.push_back("O");
  mas.push_back("F");
  mas.push_back("Ne");
  mas.push_back("Na");
  mas.push_back("Mg");
  mas.push_back("Al");
  mas.push_back("Si");
  mas.push_back("P");
  mas.push_back("S");
  mas.push_back("Cl");
  mas.push_back("Ar");
  mas.push_back("K");
  mas.push_back("Ca");
  mas.push_back("Sc");
  mas.push_back("Ti");
  mas.push_back("V");
  mas.push_back("Cr");
  mas.push_back("Mn");
  mas.push_back("Fe");
  mas.push_back("Co");
  mas.push_back("Ni");
  mas.push_back("Cu");
  mas.push_back("Zn");
  mas.push_back("Ga");
  mas.push_back("Ge");
  mas.push_back("As");
  mas.push_back("Se");
  mas.push_back("Br");
  mas.push_back("Kr");
  mas.push_back("Rb");
  mas.push_back("Sr");
  mas.push_back("Y");
  mas.push_back("Zr");
  mas.push_back("Nb");
  mas.push_back("Mo");
  mas.push_back("Tc");
  mas.push_back("Ru");
  mas.push_back("Rh");
  mas.push_back("Pd");
  mas.push_back("Ag");
  mas.push_back("Cd");
  mas.push_back("In");
  mas.push_back("Sn");
  mas.push_back("Sb");
  mas.push_back("Te");
  mas.push_back("I");
  mas.push_back("Xe");
  mas.push_back("Cs");
  mas.push_back("Ba");
  mas.push_back("La");
  mas.push_back("Ce");
  mas.push_back("Pr");
  mas.push_back("Nd");
  mas.push_back("Pm");
  mas.push_back("Sm");
  mas.push_back("Eu");
  mas.push_back("Gd");
  mas.push_back("Tb");
  mas.push_back("Dy");
  mas.push_back("Ho");
  mas.push_back("Er");
  mas.push_back("Tm");
  mas.push_back("Yb");
  mas.push_back("Lu");
  mas.push_back("Hf");
  mas.push_back("Ta");
  mas.push_back("W");
  mas.push_back("Re");
  mas.push_back("Os");
  mas.push_back("Ir");
  mas.push_back("Pt");
  mas.push_back("Au");
  mas.push_back("Hg");
  mas.push_back("Tl");
  mas.push_back("Pb");
  mas.push_back("Bi");
  mas.push_back("Po");
  mas.push_back("At");
  mas.push_back("Rn");
  mas.push_back("Fr");
  mas.push_back("Ra");
  mas.push_back("Ac");
  mas.push_back("Th");
  mas.push_back("Pa");
  mas.push_back("U");
  mas.push_back("Np");
  mas.push_back("Pu");
  mas.push_back("Am");
  mas.push_back("Cm");
  mas.push_back("Bk");
  mas.push_back("Cf");
  mas.push_back("Es");
  mas.push_back("Fm");
  int it = 0;
  M["-1"] = it++;
  M["H"] = it++;
  M["He"] = it++;
  M["Li"] = it++;
  M["Be"] = it++;
  M["B"] = it++;
  M["C"] = it++;
  M["N"] = it++;
  M["O"] = it++;
  M["F"] = it++;
  M["Ne"] = it++;
  M["Na"] = it++;
  M["Mg"] = it++;
  M["Al"] = it++;
  M["Si"] = it++;
  M["P"] = it++;
  M["S"] = it++;
  M["Cl"] = it++;
  M["Ar"] = it++;
  M["K"] = it++;
  M["Ca"] = it++;
  M["Sc"] = it++;
  M["Ti"] = it++;
  M["V"] = it++;
  M["Cr"] = it++;
  M["Mn"] = it++;
  M["Fe"] = it++;
  M["Co"] = it++;
  M["Ni"] = it++;
  M["Cu"] = it++;
  M["Zn"] = it++;
  M["Ga"] = it++;
  M["Ge"] = it++;
  M["As"] = it++;
  M["Se"] = it++;
  M["Br"] = it++;
  M["Kr"] = it++;
  M["Rb"] = it++;
  M["Sr"] = it++;
  M["Y"] = it++;
  M["Zr"] = it++;
  M["Nb"] = it++;
  M["Mo"] = it++;
  M["Tc"] = it++;
  M["Ru"] = it++;
  M["Rh"] = it++;
  M["Pd"] = it++;
  M["Ag"] = it++;
  M["Cd"] = it++;
  M["In"] = it++;
  M["Sn"] = it++;
  M["Sb"] = it++;
  M["Te"] = it++;
  M["I"] = it++;
  M["Xe"] = it++;
  M["Cs"] = it++;
  M["Ba"] = it++;
  M["La"] = it++;
  M["Ce"] = it++;
  M["Pr"] = it++;
  M["Nd"] = it++;
  M["Pm"] = it++;
  M["Sm"] = it++;
  M["Eu"] = it++;
  M["Gd"] = it++;
  M["Tb"] = it++;
  M["Dy"] = it++;
  M["Ho"] = it++;
  M["Er"] = it++;
  M["Tm"] = it++;
  M["Yb"] = it++;
  M["Lu"] = it++;
  M["Hf"] = it++;
  M["Ta"] = it++;
  M["W"] = it++;
  M["Re"] = it++;
  M["Os"] = it++;
  M["Ir"] = it++;
  M["Pt"] = it++;
  M["Au"] = it++;
  M["Hg"] = it++;
  M["Tl"] = it++;
  M["Pb"] = it++;
  M["Bi"] = it++;
  M["Po"] = it++;
  M["At"] = it++;
  M["Rn"] = it++;
  M["Fr"] = it++;
  M["Ra"] = it++;
  M["Ac"] = it++;
  M["Th"] = it++;
  M["Pa"] = it++;
  M["U"] = it++;
  M["Np"] = it++;
  M["Pu"] = it++;
  M["Am"] = it++;
  M["Cm"] = it++;
  M["Bk"] = it++;
  M["Cf"] = it++;
  M["Es"] = it++;
  M["Fm"] = it++;
  int n, k;
  cin >> n >> k;
  G.resize(k);
  for (int i = (0), _b(n); i < _b; ++i) {
    string s;
    cin >> s;
    m1.push_back(M[s]);
  }
  for (int i = (0), _b(k); i < _b; ++i) {
    string s;
    cin >> s;
    m2.push_back(M[s]);
  }
  for (int kk = (0), _b(1 << n); kk < _b; ++kk) {
    int sum = 0;
    for (int i = (0), _b(n); i < _b; ++i)
      if ((kk >> i) & 1) sum += m1[i];
    for (int i = (0), _b(k); i < _b; ++i)
      if (m2[i] == sum) G[i].push_back(kk);
  }
  memset(way, -1, sizeof(way));
  memset(dp, -1, sizeof(dp));
  int r = R(0, 0);
  if (r == 0)
    printf("NO\n");
  else {
    printf("YES\n");
    int z = 1 << 17, x, y;
    x = y = 0;
    vector<vector<string> > ans(m2.size());
    for (int zz = (0), _b(m2.size()); zz < _b; ++zz) {
      int yn = way[x][y] % z;
      x = way[x][y] / z;
      int mask = yn & (~y);
      for (int i = (0), _b(n); i < _b; ++i)
        if ((mask >> i) & 1) ans[zz].push_back(mas[m1[i]]);
      y = yn;
    }
    for (int j = (0), _b(m2.size()); j < _b; ++j) {
      for (int i = (0), _b(ans[j].size()); i < _b; ++i) {
        cout << ans[j][i];
        if (i + 1 == ans[j].size())
          printf("->");
        else
          printf("+");
      }
      cout << mas[m2[j]] << endl;
    }
  }
  return 0;
}