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;
string data[] = {"89",
                 "Ac",
                 "Actinium",
                 "227",
                 "13",
                 "Al",
                 "Aluminum",
                 "26.98154",
                 "56",
                 "Ba",
                 "Barium",
                 "137.33",
                 "4",
                 "Be",
                 "Beryllium",
                 "9.01218",
                 "83",
                 "Bi",
                 "Bismuth",
                 "208.9804",
                 "107",
                 "Bh",
                 "Bohrium",
                 "262",
                 "48",
                 "Cd",
                 "Cadmium",
                 "112.4",
                 "20",
                 "Ca",
                 "Calcium",
                 "40.08",
                 "55",
                 "Cs",
                 "Cesium",
                 "132.9054",
                 "24",
                 "Cr",
                 "Chromium",
                 "51.996",
                 "27",
                 "Co",
                 "Cobalt",
                 "58.9332",
                 "29",
                 "Cu",
                 "Copper",
                 "63.546",
                 "110",
                 "Ds",
                 "Darmstadtium",
                 "261.9",
                 "105",
                 "Db",
                 "Dubnium",
                 "261.9",
                 "87",
                 "Fr",
                 "Francium",
                 "(233)",
                 "31",
                 "Ga",
                 "Gallium",
                 "69.72",
                 "79",
                 "Au",
                 "Gold",
                 "196.9655",
                 "72",
                 "Hf",
                 "Hafnium",
                 "178.49",
                 "108",
                 "Hs",
                 "Hassium",
                 "264.8",
                 "49",
                 "In",
                 "Indium",
                 "114.82",
                 "77",
                 "Ir",
                 "Iridium",
                 "192.2",
                 "26",
                 "Fe",
                 "Iron",
                 "55.85",
                 "57",
                 "La",
                 "Lanthanum",
                 "138.91",
                 "82",
                 "Pb",
                 "Lead",
                 "207.2",
                 "3",
                 "Li",
                 "Lithium",
                 "6.941",
                 "12",
                 "Mg",
                 "Magnesium",
                 "24.305",
                 "25",
                 "Mn",
                 "Manganese",
                 "54.9380",
                 "109",
                 "Mt",
                 "Meitnerium",
                 "265.9",
                 "80",
                 "Hg",
                 "Mercury",
                 "200.59",
                 "42",
                 "Mo",
                 "Molybdenum",
                 "95.94",
                 "28",
                 "Ni",
                 "Nickel",
                 "58.71",
                 "41",
                 "Nb",
                 "Niobium",
                 "92.91",
                 "76",
                 "Os",
                 "Osmium",
                 "190.2",
                 "46",
                 "Pd",
                 "Palladium",
                 "106.42",
                 "78",
                 "Pt",
                 "Platinum",
                 "195.09",
                 "19",
                 "K",
                 "Potassium",
                 "39.0983",
                 "88",
                 "Ra",
                 "Radium",
                 "226.0254",
                 "75",
                 "Re",
                 "Rhenium",
                 "186.23",
                 "45",
                 "Rh",
                 "Rhodium",
                 "102.91",
                 "37",
                 "Rb",
                 "Rubidium",
                 "85.4678",
                 "44",
                 "Ru",
                 "Ruthenium",
                 "101.1",
                 "104",
                 "Rf",
                 "Rutherfordium",
                 "260.9",
                 "21",
                 "Sc",
                 "Scandium",
                 "44.9559",
                 "106",
                 "Sg",
                 "Seaborgium",
                 "262.94",
                 "47",
                 "Ag",
                 "Silver",
                 "107.87",
                 "11",
                 "Na",
                 "Sodium",
                 "22.98977",
                 "38",
                 "Sr",
                 "Strontium",
                 "87.62",
                 "73",
                 "Ta",
                 "Tantalum",
                 "180.95",
                 "43",
                 "Tc",
                 "Technetium",
                 "(99)",
                 "81",
                 "Tl",
                 "Thallium",
                 "204.383",
                 "50",
                 "Sn",
                 "Tin",
                 "118.69",
                 "22",
                 "Ti",
                 "Titanium",
                 "47.90",
                 "74",
                 "W",
                 "Tungsten",
                 "183.85",
                 "112",
                 "Uub",
                 "Ununbium",
                 "276.8",
                 "116",
                 "Uuh",
                 "Ununhexium",
                 "",
                 "114",
                 "Uuq",
                 "Ununquadium",
                 "289",
                 "23",
                 "V",
                 "Vanadium",
                 "50.9414",
                 "39",
                 "Y",
                 "Yttrium",
                 "88.9059",
                 "30",
                 "Zn",
                 "Zinc",
                 "65.37",
                 "40",
                 "Zr",
                 "Zirconium",
                 "91.22",
                 "51",
                 "Sb",
                 "Antimony",
                 "121.75",
                 "33",
                 "As",
                 "Arsenic",
                 "74.9216",
                 "85",
                 "At",
                 "Astatine",
                 "(210)",
                 "5",
                 "B",
                 "Boron",
                 "10.81",
                 "32",
                 "Ge",
                 "Germanium",
                 "72.59",
                 "84",
                 "Po",
                 "Polonium",
                 "(210)",
                 "14",
                 "Si",
                 "Silicon",
                 "28.0855",
                 "52",
                 "Te",
                 "Tellurium",
                 "127.6",
                 "35",
                 "Br",
                 "Bromine",
                 "79.904",
                 "6",
                 "C",
                 "Carbon",
                 "12.011",
                 "17",
                 "Cl",
                 "Chlorine",
                 "35.453",
                 "9",
                 "F",
                 "Fluorine",
                 "18.998403",
                 "1",
                 "H",
                 "Hydrogen",
                 "1.007825",
                 "53",
                 "I",
                 "Iodine",
                 "126.9045",
                 "7",
                 "N",
                 "Nitrogen",
                 "14.0067",
                 "8",
                 "O",
                 "Oxygen",
                 "15.999",
                 "15",
                 "P",
                 "Phosphorus",
                 "",
                 "34",
                 "Se",
                 "Selenium",
                 "78.96",
                 "16",
                 "S",
                 "Sulphur",
                 "32.06",
                 "18",
                 "Ar",
                 "Argon",
                 "39.948",
                 "2",
                 "He",
                 "Helium",
                 "4.00260",
                 "36",
                 "Kr",
                 "Krypton",
                 "83.80",
                 "10",
                 "Ne",
                 "Neon",
                 "20.179",
                 "86",
                 "Rn",
                 "Radon",
                 "(222)",
                 "54",
                 "Xe",
                 "Xenon",
                 "131.29",
                 "95",
                 "Am",
                 "Americium",
                 "(243)",
                 "97",
                 "Bk",
                 "Berkelium",
                 "(247)",
                 "98",
                 "Cf",
                 "Californium",
                 "(251)",
                 "58",
                 "Ce",
                 "Cerium",
                 "140.12",
                 "96",
                 "Cm",
                 "Curium",
                 "(247)",
                 "66",
                 "Dy",
                 "Dysprosium",
                 "162.50",
                 "99",
                 "Es",
                 "Einsteinium",
                 "254",
                 "68",
                 "Er",
                 "Erbium",
                 "167.26",
                 "63",
                 "Eu",
                 "Europium",
                 "167.26",
                 "100",
                 "Fm",
                 "Fermium",
                 "(257)",
                 "64",
                 "Gd",
                 "Gadolinium",
                 "157.25",
                 "67",
                 "Ho",
                 "Holmium",
                 "164.9",
                 "103",
                 "Lr",
                 "Lawrencium",
                 "(262)",
                 "71",
                 "Lu",
                 "Lutetium",
                 "174.97",
                 "101",
                 "Md",
                 "Mendelevium",
                 "(258)",
                 "60",
                 "Nd",
                 "Neodymium",
                 "",
                 "93",
                 "Np",
                 "Neptunium",
                 "(237)",
                 "102",
                 "No",
                 "Nobelium",
                 "259",
                 "94",
                 "Pu",
                 "Plutonium",
                 "(244)",
                 "59",
                 "Pr",
                 "Praseodymium",
                 "140.91",
                 "61",
                 "Pm",
                 "Promethium",
                 "(147)",
                 "91",
                 "Pa",
                 "Protactinium",
                 "231.0359",
                 "62",
                 "Sm",
                 "Samarium",
                 "150.35",
                 "65",
                 "Tb",
                 "Terbium",
                 "158.92534",
                 "90",
                 "Th",
                 "Thorium",
                 "232.04",
                 "69",
                 "Tm",
                 "Thulium",
                 "168.93",
                 "92",
                 "U",
                 "Uranium",
                 "238.03",
                 "70",
                 "Yb",
                 "Ytterbium",
                 "173.04"
                 "-"};
map<string, int> atomnums;
int a[30], b[30], rem[(1 << 18)], ans[30];
vector<int> v[101];
int n, k;
int vis[18][(1 << 18)];
int dfs(int cloc, int cmask) {
  if (cloc == k + 1) {
    return (cmask == ((1 << n) - 1));
  }
  if (vis[cloc][cmask]) return 0;
  vis[cloc][cmask] = 1;
  for (int j = 0; j < v[b[cloc]].size(); j++) {
    if ((cmask & v[b[cloc]][j]) == 0)
      if (dfs(cloc + 1, cmask | v[b[cloc]][j])) {
        ans[cloc] = v[b[cloc]][j];
        return 1;
      }
  }
  return 0;
}
string revmap[200];
int main() {
  int i, x, j;
  for (i = 0;; i += 4) {
    sscanf(data[i].c_str(), "%d", &x);
    atomnums[data[i + 1]] = x;
    revmap[x] = data[i + 1];
    if (data[i] == "70") break;
  }
  cin >> n >> k;
  string s;
  for (i = 1; i <= n; i++) {
    cin >> s;
    a[i] = atomnums[s];
  }
  for (i = 1; i <= k; i++) {
    cin >> s;
    b[i] = atomnums[s];
  }
  int y = 0, cur, csum;
  for (i = 0; i < (1 << n); i++) {
    y = i;
    cur = 1;
    csum = 0;
    while (y) {
      if ((y & 1)) csum += a[cur];
      cur++;
      y >>= 1;
    }
    if (csum <= 100 && __builtin_popcount(i) <= n - k + 1) {
      rem[i] = csum;
      v[csum].push_back(i);
    }
  }
  if (dfs(1, 0)) {
    printf("YES\n");
    for (i = 1; i <= k; i++) {
      y = ans[i];
      cur = 1;
      int fl = 0;
      while (y) {
        if ((y & 1)) {
          if (fl) printf("+");
          cout << revmap[a[cur]];
          fl = 1;
        }
        cur++;
        y >>= 1;
      }
      cout << "->" << revmap[b[i]] << endl;
    }
  } else {
    printf("NO\n");
  }
  return 0;
}