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.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeMap;


public class B {

	static TreeMap<String, String> map;
	static void process()
	{
		map = new TreeMap<>();
		map.put("H", "1");
		map.put("He", "2");
		map.put("Li", "3");
		map.put("Be", "4");
		map.put("B", "5");
		map.put("C", "6");
		map.put("N", "7");
		map.put("O", "8");
		map.put("F", "9");
		map.put("Ne", "10");
		map.put("Na", "11");
		map.put("Mg", "12");
		map.put("Al", "13");
		map.put("Si", "14");
		map.put("P", "15");
		map.put("S", "16");
		map.put("Cl", "17");
		map.put("Ar", "18");
		map.put("K", "19");
		map.put("Ca", "20");
		map.put("Sc", "21");
		map.put("Ti", "22");
		map.put("V", "23");
		map.put("Cr", "24");
		map.put("Mn", "25");
		map.put("Fe", "26");
		map.put("Co", "27");
		map.put("Ni", "28");
		map.put("Cu", "29");
		map.put("Zn", "30");
		map.put("Ga", "31");
		map.put("Ge", "32");
		map.put("As", "33");
		map.put("Se", "34");
		map.put("Br", "35");
		map.put("Kr", "36");
		map.put("Rb", "37");
		map.put("Sr", "38");
		map.put("Y", "39");
		map.put("Zr", "40");
		map.put("Nb", "41");
		map.put("Mo", "42");
		map.put("Tc", "43");
		map.put("Ru", "44");
		map.put("Rh", "45");
		map.put("Pd", "46");
		map.put("Ag", "47");
		map.put("Cd", "48");
		map.put("In", "49");
		map.put("Sn", "50");
		map.put("Sb", "51");
		map.put("Te", "52");
		map.put("I", "53");
		map.put("Xe", "54");
		map.put("Cs", "55");
		map.put("Ba", "56");
		map.put("La", "57");
		map.put("Ce", "58");
		map.put("Pr", "59");
		map.put("Nd", "60");
		map.put("Pm", "61");
		map.put("Sm", "62");
		map.put("Eu", "63");
		map.put("Gd", "64");
		map.put("Tb", "65");
		map.put("Dy", "66");
		map.put("Ho", "67");
		map.put("Er", "68");
		map.put("Tm", "69");
		map.put("Yb", "70");
		map.put("Lu", "71");
		map.put("Hf", "72");
		map.put("Ta", "73");
		map.put("W", "74");
		map.put("Re", "75");
		map.put("Os", "76");
		map.put("Ir", "77");
		map.put("Pt", "78");
		map.put("Au", "79");
		map.put("Hg", "80");
		map.put("Tl", "81");
		map.put("Pb", "82");
		map.put("Bi", "83");
		map.put("Po", "84");
		map.put("At", "85");
		map.put("Rn", "86");
		map.put("Fr", "87");
		map.put("Ra", "88");
		map.put("Ac", "89");
		map.put("Th", "90");
		map.put("Pa", "91");
		map.put("U", "92");
		map.put("Np", "93");
		map.put("Pu", "94");
		map.put("Am", "95");
		map.put("Cm", "96");
		map.put("Bk", "97");
		map.put("Cf", "98");
		map.put("Es", "99");
		map.put("Fm", "100");

	}

	public static void main(String[] args) throws IOException 
	{
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		process();

		int n = sc.nextInt(), k = sc.nextInt();
		int[] a = new int[n], b = new int[k];
		String[] sym1 = new String[n], sym2 = new String[n];
		for(int i = 0; i < n; ++i)
			a[i] = Integer.parseInt(map.get(sym1[i] = sc.next()));
		for(int i = 0; i < k; ++i)
			b[i] = Integer.parseInt(map.get(sym2[i] = sc.next()));
		int[] sum = new int[1<<n];
		for(int i = 0; i < n; ++i)
			sum[1<<i] = a[i];
		for(int i = 1; i < 1<<n; ++i)
			if((i & i - 1) != 0)
				sum[i] = sum[i ^ (i & -i)] + sum[i & -i];

		int[] len = new int[1<<n], rem = new int[1<<n], addedAtom = new int[1<<n];
		Arrays.fill(len, -1);
		rem[0] = b[0];
		len[0] = 0;
		for(int msk = 0; msk < 1<<n; ++msk)
			if(len[msk] != -1)
			{
				int curRem = rem[msk], curLen = len[msk];
				for(int i = 0; i < n; ++i)
					if((msk & 1<<i) == 0 && curRem - a[i] >= 0)
					{
						len[msk | 1<<i] = curLen + (curRem - a[i] == 0 ? 1 : 0);
						rem[msk | 1<<i] = (curRem - a[i] == 0 ? curLen == k - 1 ? 0 : b[curLen + 1] : curRem - a[i]);
						addedAtom[msk | 1<<i] = i;
					}

			}
		if(len[(1<<n) - 1] == -1)
			out.println("NO");
		else
		{
			out.println("YES");
			StringBuilder sb = new StringBuilder();
			int msk = (1<<n) - 1, idx = k - 1;
			boolean first = true;
			while(msk > 0)
			{
				int x = addedAtom[msk];
				if(first)
					first = false;
				else
					sb.append("+");
				sb.append(sym1[x]);
				msk ^= 1<<x;
				if(len[msk] == idx && rem[msk] == b[idx])
				{
					sb.append("->"+sym2[idx--]+"\n");
					first = true;
				}
			}
			out.print(sb);
		}

		out.flush();
		out.close();
	}

	static class Scanner 
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public Scanner(FileReader r){	br = new BufferedReader(r);}

		public String next() throws IOException 
		{
			while (st == null || !st.hasMoreTokens()) 
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException { return Double.parseDouble(next()); }

		public boolean ready() throws IOException {return br.ready();}


	}
}