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 JAVA):

Solution:
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;

public class BetaRound65_E implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    public static void main(String[] args) {
        new Thread(null, new BetaRound65_E(), "", 256 * (1L << 20)).start();
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            if (System.getProperty("ONLINE_JUDGE") != null) {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                in = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            }
            Locale.setDefault(Locale.US);
            solve();
            in.close();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Throwable t) {
            t.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    /** http://pastebin.com/j0xdUjDn */
    static class Utils {

        private Utils() {}

        public static void mergeSort(int[] a) {
            mergeSort(a, 0, a.length - 1);
        }

        private static final int MAGIC_VALUE = 50;

        private static void mergeSort(int[] a, int leftIndex, int rightIndex) {
            if (leftIndex < rightIndex) {
                if (rightIndex - leftIndex <= MAGIC_VALUE) {
                    insertionSort(a, leftIndex, rightIndex);
                } else {
                    int middleIndex = (leftIndex + rightIndex) / 2;
                    mergeSort(a, leftIndex, middleIndex);
                    mergeSort(a, middleIndex + 1, rightIndex);
                    merge(a, leftIndex, middleIndex, rightIndex);
                }
            }
        }

        private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {
            int length1 = middleIndex - leftIndex + 1;
            int length2 = rightIndex - middleIndex;
            int[] leftArray = new int[length1];
            int[] rightArray = new int[length2];
            System.arraycopy(a, leftIndex, leftArray, 0, length1);
            System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);
            for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {
                if (i == length1) {
                    a[k] = rightArray[j++];
                } else if (j == length2) {
                    a[k] = leftArray[i++];
                } else {
                    a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];
                }
            }
        }

        private static void insertionSort(int[] a, int leftIndex, int rightIndex) {
            for (int i = leftIndex + 1; i <= rightIndex; i++) {
                int current = a[i];
                int j = i - 1;
                while (j >= leftIndex && a[j] > current) {
                    a[j + 1] = a[j];
                    j--;
                }
                a[j + 1] = current;
            }
        }

    }

    // solution

    /*for (int i = 1; i <= 100; i++) {
        String line = in.readLine();
        String s = line.substring(line.indexOf("\"")+1, line.lastIndexOf("\""));
        int x = Integer.parseInt(line.substring(line.lastIndexOf(" ") + 1, line.length() - 1));
        out.printf("put(\"%s\", %d);\n", s, x);
    }*/
    
    HashMap<String, Integer> stringsToInts = new HashMap<String, Integer>(){{
        put("H", 1);
        put("He", 2);
        put("Li", 3);
        put("Be", 4);
        put("B", 5);
        put("C", 6);
        put("N", 7);
        put("O", 8);
        put("F", 9);
        put("Ne", 10);
        put("Na", 11);
        put("Mg", 12);
        put("Al", 13);
        put("Si", 14);
        put("P", 15);
        put("S", 16);
        put("Cl", 17);
        put("Ar", 18);
        put("K", 19);
        put("Ca", 20);
        put("Sc", 21);
        put("Ti", 22);
        put("V", 23);
        put("Cr", 24);
        put("Mn", 25);
        put("Fe", 26);
        put("Co", 27);
        put("Ni", 28);
        put("Cu", 29);
        put("Zn", 30);
        put("Ga", 31);
        put("Ge", 32);
        put("As", 33);
        put("Se", 34);
        put("Br", 35);
        put("Kr", 36);
        put("Rb", 37);
        put("Sr", 38);
        put("Y", 39);
        put("Zr", 40);
        put("Nb", 41);
        put("Mo", 42);
        put("Tc", 43);
        put("Ru", 44);
        put("Rh", 45);
        put("Pd", 46);
        put("Ag", 47);
        put("Cd", 48);
        put("In", 49);
        put("Sn", 50);
        put("Sb", 51);
        put("Te", 52);
        put("I", 53);
        put("Xe", 54);
        put("Cs", 55);
        put("Ba", 56);
        put("La", 57);
        put("Ce", 58);
        put("Pr", 59);
        put("Nd", 60);
        put("Pm", 61);
        put("Sm", 62);
        put("Eu", 63);
        put("Gd", 64);
        put("Tb", 65);
        put("Dy", 66);
        put("Ho", 67);
        put("Er", 68);
        put("Tm", 69);
        put("Yb", 70);
        put("Lu", 71);
        put("Hf", 72);
        put("Ta", 73);
        put("W", 74);
        put("Re", 75);
        put("Os", 76);
        put("Ir", 77);
        put("Pt", 78);
        put("Au", 79);
        put("Hg", 80);
        put("Tl", 81);
        put("Pb", 82);
        put("Bi", 83);
        put("Po", 84);
        put("At", 85);
        put("Rn", 86);
        put("Fr", 87);
        put("Ra", 88);
        put("Ac", 89);
        put("Th", 90);
        put("Pa", 91);
        put("U", 92);
        put("Np", 93);
        put("Pu", 94);
        put("Am", 95);
        put("Cm", 96);
        put("Bk", 97);
        put("Cf", 98);
        put("Es", 99);
        put("Fm", 100);
    }};
    
    HashMap<Integer, String> intsToStrings = new HashMap<Integer, String>(){{
        for (Map.Entry<String, Integer> e : stringsToInts.entrySet()) {
            put(e.getValue(), e.getKey());
        }
    }};
    
    int n, m;
    int[] start, finish;
    
    void solve() throws IOException {
        n = readInt();
        m = readInt();
        start = new int[n];
        finish = new int[m];
        for (int i = 0; i < n; i++) {
            start[i] = stringsToInts.get(readString());
        }
        for (int i = 0; i < m; i++) {
            finish[i] = stringsToInts.get(readString());
        }
        p = new int[m];
        Utils.mergeSort(start);
        Utils.mergeSort(finish);
        for (int i = 0, j = 0; i < n && j < m && removed < min(n, m); ) {
            if (start[i] == finish[j]) {
                shift(start, i);
                shift(finish, j);
                removed++;
                p[m - removed] = 1 << (n - removed);
            } else if (start[i] > finish[j]) j++; else i++;
        }
        n -= removed;
        m -= removed;
        if (getMin(start, n) > getMin(finish, m) || getMax(start, n) > getMax(finish, m)) {
            out.println("NO");
            return;
        }
        reverse(start, n);
        reverse(finish, m);
        go((1 << n) - 1, 0);
        if (!ok) out.println("NO");
    }
    
    void reverse(int[] a, int n) {
        for (int i = 0; i < n/2; i++) {
            int t = a[i];
            a[i] = a[n - i - 1];
            a[n - i - 1] = t;
        }
    }
    
    int getMin(int[] a, int n) {
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            min = min(min, a[i]);
        }
        return min;
    }
    
    int getMax(int[] a, int n) {
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            max = max(max, a[i]);
        }
        return max;
    }
    
    void shuffle(int[] a, int n) {
        Random r = new Random(5732057320572305L);
        for (int i = 0; i < n; i++) {
            int j = i + r.nextInt(n - i);
            int t = a[i];
            a[i] = a[j];
            a[j] = t;
        }
    }
    
    void shift(int[] a, int k) {
        int p = a[k], n = a.length;
        for (int i = k; i < n-1; i++) {
            int t = a[i];
            a[i] = a[i+1];
            a[i+1] = t;
        }
        a[n-1] = p;
    }

    int[] p;
    boolean ok = false;
    int used = 0;
    int removed = 0;
    
    void print() {
        n += removed;
        m += removed;
        out.println("YES");
        for (int i = 0; i < m; i++) {
            int bc = Integer.bitCount(p[i]);
            for (int j = 0; j < n; j++) {
                if (((1 << j) & p[i]) != 0) {
                    out.print(intsToStrings.get(start[j]));
                    bc--;
                    if (bc != 0) {
                        out.print("+");
                    }
                    else {
                        out.print("->");
                    }
                }
            }
            out.println(intsToStrings.get(finish[i]));
        }
    }
    
    void go(int mask, int index) {
        if (ok) return;
        if (mask == 0) {
            print();
            ok = true;
            return;
        }
        int need = finish[index];
        for (int subMask = mask; subMask != 0; subMask = mask & (subMask - 1)) {
            if ((subMask & used) != 0) continue;
            int sum = 0;
            for (int i = 0; i < n; i++) {
                if (((1 << i) & subMask) != 0) {
                    sum += start[i];
                    if (sum > need) break;
                }
            }
            if (sum == need) {
                p[index] = subMask;
                used ^= subMask;
                go(mask ^ subMask, index + 1);
                if (ok) return;
                used ^= subMask;
            }
        }
    }

}