#include <bits/stdc++.h>
using namespace std;
int c[21], b[21], a[21], s[21];
string x[100005];
int main() {
  int n;
  for (int i = 0; i <= 10; i = i + 2) scanf("%d", &c[i]);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    if (x[i] == "S")
      a[0]++;
    else if (x[i] == "S,M")
      a[1]++;
    else if (x[i] == "M")
      a[2]++;
    else if (x[i] == "M,L")
      a[3]++;
    else if (x[i] == "L")
      a[4]++;
    else if (x[i] == "L,XL")
      a[5]++;
    else if (x[i] == "XL")
      a[6]++;
    else if (x[i] == "XL,XXL")
      a[7]++;
    else if (x[i] == "XXL")
      a[8]++;
    else if (x[i] == "XXL,XXXL")
      a[9]++;
    else
      a[10]++;
  }
  int checker = 1;
  for (int i = 0; i <= 10; i++) {
    b[i] = a[i];
  }
  for (int i = 0; i <= 10; i++) {
    if (i % 2 == 0) {
      c[i] -= a[i];
      if (c[i] < 0) checker = 0;
    } else {
      a[i] -= c[i - 1];
      s[i] += c[i - 1];
      if (a[i] > 0) c[i + 1] -= a[i];
    }
  }
  if (checker == 0) {
    printf("NO");
    return 0;
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) {
    if (x[i] == "S")
      printf("S\n");
    else if (x[i] == "S,M") {
      if (s[1] > 0) {
        printf("S\n");
        s[1]--;
      } else
        printf("M\n");
    } else if (x[i] == "M")
      printf("M\n");
    else if (x[i] == "M,L") {
      if (s[3] > 0) {
        printf("M\n");
        s[3]--;
      } else
        printf("L\n");
    } else if (x[i] == "L")
      printf("L\n");
    else if (x[i] == "L,XL") {
      if (s[5] > 0) {
        printf("L\n");
        s[5]--;
      } else
        printf("XL\n");
    } else if (x[i] == "XL")
      printf("XL\n");
    else if (x[i] == "XL,XXL") {
      if (s[7] > 0) {
        printf("XL\n");
        s[7]--;
      } else
        printf("XXL\n");
    } else if (x[i] == "XXL")
      printf("XXL\n");
    else if (x[i] == "XXL,XXXL") {
      if (s[9] > 0) {
        printf("XXL\n");
        s[9]--;
      } else
        printf("XXXL\n");
    } else
      printf("XXXL\n");
  }
}
