#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
char s[20];
char size[20][20] = {"S",   "M",   "L",    "XL",     "XXL",     "XXXL",
                     "S,M", "M,L", "L,XL", "XL,XXL", "XXL,XXXL"};
int num[10];
vector<int> cnt1[10], cnt2[10];
int n;
int p[maxn];
int main() {
  for (int i = 0; i < 6; i++) {
    scanf("%d", num + i);
  }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    for (int j = 0; j < 11; j++) {
      if (strcmp(s, size[j]) == 0) {
        if (j < 6) {
          cnt1[j].push_back(i);
        } else {
          cnt2[j - 6].push_back(i);
        }
        p[i] = j;
        break;
      }
    }
  }
  for (int i = 0; i < 6; i++) {
    num[i] -= cnt1[i].size();
    if (num[i] < 0) {
      printf("NO\n");
      return 0;
    }
  }
  int pos = 0;
  for (int i = 0; num[0] > 0 && i < cnt2[0].size(); i++) {
    p[cnt2[0][pos++]] = 0;
    num[0]--;
  }
  for (int i = 0; i < 5; i++) {
    for (int j = pos; j < cnt2[i].size(); j++) {
      p[cnt2[i][j]] = i + 1;
      num[i + 1]--;
    }
    if (num[i + 1] < 0) {
      printf("NO\n");
      return 0;
    }
    pos = 0;
    for (int j = 0; num[i + 1] > 0 && j < cnt2[i + 1].size(); j++) {
      num[i + 1]--;
      p[cnt2[i + 1][pos++]] = i + 1;
    }
  }
  if (num[5] < 0) {
    printf("NO\n");
  } else {
    printf("YES\n");
    for (int i = 0; i < n; i++) {
      printf("%s\n", size[p[i]]);
    }
  }
  return 0;
}
