727_D. T-shirts Distribution
The organizers of a programming contest have decided to present t-shirts to participants. There are six different t-shirts sizes in this problem: S, M, L, XL, XXL, XXXL (sizes are listed in increasing order). The t-shirts are already prepared. For each size from S to XXXL you are given the number of t-shirts of this size.

During the registration, the organizers asked each of the n participants about the t-shirt size he wants. If a participant hesitated between two sizes, he could specify two neighboring sizes — this means that any of these two sizes suits him.

Write a program that will determine whether it is possible to present a t-shirt to each participant of the competition, or not. Of course, each participant should get a t-shirt of proper size: 

  * the size he wanted, if he specified one size; 
  * any of the two neibouring sizes, if he specified two sizes. 



If it is possible, the program should find any valid distribution of the t-shirts.

Input

The first line of the input contains six non-negative integers — the number of t-shirts of each size. The numbers are given for the sizes S, M, L, XL, XXL, XXXL, respectively. The total number of t-shirts doesn't exceed 100 000.

The second line contains positive integer n (1 ≤ n ≤ 100 000) — the number of participants.

The following n lines contain the sizes specified by the participants, one line per participant. The i-th line contains information provided by the i-th participant: single size or two sizes separated by comma (without any spaces). If there are two sizes, the sizes are written in increasing order. It is guaranteed that two sizes separated by comma are neighboring.

Output

If it is not possible to present a t-shirt to each participant, print «NO» (without quotes).

Otherwise, print n + 1 lines. In the first line print «YES» (without quotes). In the following n lines print the t-shirt sizes the orginizers should give to participants, one per line. The order of the participants should be the same as in the input.

If there are multiple solutions, print any of them.

Examples

Input

0 1 0 1 1 0
3
XL
S,M
XL,XXL


Output

YES
XL
M
XXL


Input

1 1 2 0 1 1
5
S
M
S,M
XXL,XXXL
XL,XXL


Output

NO
```python

from math import *
from sys import *

def conv(s):
	if s=="S" or s=="S\n":
		return 1
	if s=="M" or s=="M\n":
		return 2
	if s=="L" or s=="L\n":
		return 3
	if s=="XL" or s=="XL\n":
		return 4
	if s=="XXL" or s=="XXL\n":
		return 5
	return 6

def uncon(x):
	if x==1:
		return "S"
	if x==2:
		return "M"
	if x==3:
		return "L"
	if x==4:
		return "XL"
	if x==5:
		return "XXL"
	return "XXXL"
	
s=[]
m=[]
l=[]
xl=[]
xxl=[]
sp,mp,lp,xp,xxp=0,0,0,0,0
t=[0]
t+=[int(z) for z in stdin.readline().split()]
n=int(stdin.readline())
ans=[0]*n
#print(t)
for i in range(n):
	e=[conv(z) for z in stdin.readline().split(",")]
	#print(e)
	if len(e)==1:
		ans[i]=e[0]
		t[e[0]]-=1
		if t[e[0]]<0:
			print("NO")
			exit(0)
	else:
		if e[0]==1:
			s.append(i)
		if e[0]==2:
			m.append(i)
		if e[0]==3:
			l.append(i)
		if e[0]==4:
			xl.append(i)
		if e[0]==5:
			xxl.append(i)
while len(s)!=sp and t[1]:
	ans[s[sp]]=1
	sp+=1
	t[1]-=1
while len(s)!=sp and t[2]:
	ans[s[sp]]=2
	sp+=1
	t[2]-=1
if len(s)!=sp:
	print("NO")
	exit(0)
while len(m)!=mp and t[2]:
	ans[m[mp]]=2
	mp+=1
	t[2]-=1
while len(m)!=mp and t[3]:
	ans[m[mp]]=3
	mp+=1
	t[3]-=1
if len(m)!=mp:
	print("NO")
	exit(0)
while len(l)!=lp and t[3]:
	ans[l[lp]]=3
	lp+=1
	t[3]-=1
while len(l)!=lp and t[4]:
	ans[l[lp]]=4
	lp+=1
	t[4]-=1
if len(l)!=lp:
	print("NO")
	exit(0)
while len(xl)!=xp and t[4]:
	ans[xl[xp]]=4
	xp+=1
	t[4]-=1
while len(xl)!=xp and t[5]:
	ans[xl[xp]]=5
	xp+=1
	t[5]-=1
if len(xl)!=xp:
	print("NO")
	exit(0)
while len(xxl)!=xxp and t[5]:
	ans[xxl[xxp]]=5
	xxp+=1
	t[5]-=1
while len(xxl)!=xxp and t[6]:
	ans[xxl[xxp]]=6
	xxp+=1
	t[6]-=1
if len(xxl)!=xxp:
	print("NO")
	exit(0)
res=[uncon(z) for z in ans]
print("YES")
for i in res:
	print(i)
```