#include <bits/stdc++.h>
using namespace std;
int n, a[7], t[100005];
list<int> mlist[7];
char s[105];
bool ok = true;
int main() {
  for (int i = 0; i < 6; i++) scanf("%d", &a[i]);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    if (strcmp(s, "S") == 0) a[0]--, t[i] = 0;
    if (strcmp(s, "M") == 0) a[1]--, t[i] = 1;
    if (strcmp(s, "L") == 0) a[2]--, t[i] = 2;
    if (strcmp(s, "XL") == 0) a[3]--, t[i] = 3;
    if (strcmp(s, "XXL") == 0) a[4]--, t[i] = 4;
    if (strcmp(s, "XXXL") == 0) a[5]--, t[i] = 5;
    if (strcmp(s, "S,M") == 0) mlist[0].push_back(i);
    if (strcmp(s, "M,L") == 0) mlist[1].push_back(i);
    if (strcmp(s, "L,XL") == 0) mlist[2].push_back(i);
    if (strcmp(s, "XL,XXL") == 0) mlist[3].push_back(i);
    if (strcmp(s, "XXL,XXXL") == 0) mlist[4].push_back(i);
  }
  for (int i = 0; i < 5; i++) {
    while (!mlist[i].empty() && a[i] != 0) {
      t[mlist[i].front()] = i;
      a[i]--;
      mlist[i].pop_front();
    }
    while (!mlist[i].empty() && a[i + 1] != 0) {
      t[mlist[i].front()] = i + 1;
      a[i + 1]--;
      mlist[i].pop_front();
    }
    if (!mlist[i].empty() && a[i + 1] == 0) {
      ok = false;
      break;
    }
  }
  for (int i = 0; i < 6; i++) {
    if (a[i] < 0) ok = false;
  }
  if (!ok)
    printf("NO");
  else {
    printf("YES\n");
    for (int i = 0; i < n; i++) {
      if (t[i] == 0) printf("S\n");
      if (t[i] == 1) printf("M\n");
      if (t[i] == 2) printf("L\n");
      if (t[i] == 3) printf("XL\n");
      if (t[i] == 4) printf("XXL\n");
      if (t[i] == 5) printf("XXXL\n");
    }
  }
  return 0;
}
