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>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-8;
const long double PI = 3.1415926535897932384626433832795;
const int MAXN = 18;
int n, k, va[MAXN], vb[MAXN], vs[1 << MAXN];
int nxt[1 << MAXN], prv[1 << MAXN];
string a[MAXN], b[MAXN];
vector<int> g[MAXN];
map<string, int> m;
bool d[1 << MAXN];
void init() {
  m["H"] = 1;
  m["He"] = 2;
  m["Li"] = 3;
  m["Be"] = 4;
  m["B"] = 5;
  m["C"] = 6;
  m["N"] = 7;
  m["O"] = 8;
  m["F"] = 9;
  m["Ne"] = 10;
  m["Na"] = 11;
  m["Mg"] = 12;
  m["Al"] = 13;
  m["Si"] = 14;
  m["P"] = 15;
  m["S"] = 16;
  m["Cl"] = 17;
  m["Ar"] = 18;
  m["K"] = 19;
  m["Ca"] = 20;
  m["Sc"] = 21;
  m["Ti"] = 22;
  m["V"] = 23;
  m["Cr"] = 24;
  m["Mn"] = 25;
  m["Fe"] = 26;
  m["Co"] = 27;
  m["Ni"] = 28;
  m["Cu"] = 29;
  m["Zn"] = 30;
  m["Ga"] = 31;
  m["Ge"] = 32;
  m["As"] = 33;
  m["Se"] = 34;
  m["Br"] = 35;
  m["Kr"] = 36;
  m["Rb"] = 37;
  m["Sr"] = 38;
  m["Y"] = 39;
  m["Zr"] = 40;
  m["Nb"] = 41;
  m["Mo"] = 42;
  m["Tc"] = 43;
  m["Ru"] = 44;
  m["Rh"] = 45;
  m["Pd"] = 46;
  m["Ag"] = 47;
  m["Cd"] = 48;
  m["In"] = 49;
  m["Sn"] = 50;
  m["Sb"] = 51;
  m["Te"] = 52;
  m["I"] = 53;
  m["Xe"] = 54;
  m["Cs"] = 55;
  m["Ba"] = 56;
  m["La"] = 57;
  m["Ce"] = 58;
  m["Pr"] = 59;
  m["Nd"] = 60;
  m["Pm"] = 61;
  m["Sm"] = 62;
  m["Eu"] = 63;
  m["Gd"] = 64;
  m["Tb"] = 65;
  m["Dy"] = 66;
  m["Ho"] = 67;
  m["Er"] = 68;
  m["Tm"] = 69;
  m["Yb"] = 70;
  m["Lu"] = 71;
  m["Hf"] = 72;
  m["Ta"] = 73;
  m["W"] = 74;
  m["Re"] = 75;
  m["Os"] = 76;
  m["Ir"] = 77;
  m["Pt"] = 78;
  m["Au"] = 79;
  m["Hg"] = 80;
  m["Tl"] = 81;
  m["Pb"] = 82;
  m["Bi"] = 83;
  m["Po"] = 84;
  m["At"] = 85;
  m["Rn"] = 86;
  m["Fr"] = 87;
  m["Ra"] = 88;
  m["Ac"] = 89;
  m["Th"] = 90;
  m["Pa"] = 91;
  m["U"] = 92;
  m["Np"] = 93;
  m["Pu"] = 94;
  m["Am"] = 95;
  m["Cm"] = 96;
  m["Bk"] = 97;
  m["Cf"] = 98;
  m["Es"] = 99;
  m["Fm"] = 100;
  m["Md"] = 101;
  m["No"] = 102;
  m["Lr"] = 103;
  m["Rf"] = 104;
  m["Db"] = 105;
}
void print(vector<int> t, string el) {
  for (int i = 0; i < (int)(t.size()); i++) {
    if (i != 0) cout << "+";
    cout << a[t[i]];
  }
  cout << "->" << el << endl;
}
vector<int> toVector(int mask) {
  vector<int> a;
  for (int i = 0; i < (int)(n); i++)
    if ((mask & (1 << i)) != 0) a.push_back(i);
  return a;
}
void solve(int mask, int v) {
  if (mask == 0) return;
  solve(mask ^ prv[mask], v - 1);
  print(toVector(prv[mask]), b[v]);
}
int main() {
  init();
  cin >> n >> k;
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
    va[i] = m[a[i]];
  }
  memset(nxt, 255, sizeof nxt);
  nxt[0] = 0;
  for (int mask = 0; mask < (int)(1 << n); mask++)
    for (int i = 0; i < (int)(n); i++)
      if ((mask & (1 << i)) != 0) vs[mask] += va[i];
  int sum = 0;
  for (int i = 0; i < (int)(k); i++) {
    cin >> b[i];
    vb[i] = m[b[i]];
    sum += vb[i];
    for (int mask = 0; mask < (int)(1 << n); mask++) {
      if (vs[mask] == vb[i]) g[i].push_back(mask);
      if (vs[mask] == sum) nxt[mask] = i + 1;
    }
  }
  d[0] = true;
  for (int mask = 0; mask < (int)(1 << n); mask++) {
    if (!d[mask] || nxt[mask] == -1) continue;
    int id = nxt[mask];
    for (int i = 0; i < (int)(g[id].size()); i++) {
      int nm = g[id][i];
      if ((mask & nm) == 0) {
        prv[mask ^ nm] = nm;
        d[mask ^ nm] = true;
      }
    }
  }
  int M = (1 << n) - 1;
  if (!d[M]) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  solve(M, k - 1);
  return 0;
}