#include <bits/stdc++.h>
using namespace std;
const long long PR = 1000000009;
long long avail[6] = {0};
struct person {
  int ch1, noc;
  int allot;
  person() { allot = -1; }
} Ppl[100009];
int n;
int main() {
  ios::sync_with_stdio(false);
  for (int i = 0; i < 6; i++) cin >> avail[i];
  cin >> n;
  char choic[20];
  for (int i = 0; i < n; i++) {
    cin >> choic;
    int fl = 0;
    for (int j = 0; choic[j] != '\0'; j++)
      if (choic[j] == ',') fl = 1;
    if (fl)
      Ppl[i].noc = 2;
    else
      Ppl[i].noc = 1;
    if (choic[0] == 'S') {
      Ppl[i].ch1 = 0;
      continue;
    }
    if (choic[0] == 'M') {
      Ppl[i].ch1 = 1;
      continue;
    }
    if (choic[0] == 'L') {
      Ppl[i].ch1 = 2;
      continue;
    }
    if (choic[1] == 'L') {
      Ppl[i].ch1 = 3;
      continue;
    }
    if (choic[2] == 'L') {
      Ppl[i].ch1 = 4;
      continue;
    }
    if (choic[3] == 'L') {
      Ppl[i].ch1 = 5;
      continue;
    }
  }
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < n; j++) {
      if (Ppl[j].ch1 == i && Ppl[j].allot == -1 && Ppl[j].noc == 1) {
        avail[i]--;
        Ppl[j].allot = i;
        if (avail[i] < 0) {
          cout << "NO" << endl;
          return 0;
        }
      }
    }
    for (int j = 0; j < n; j++) {
      if (Ppl[j].ch1 == i && Ppl[j].allot == -1 && Ppl[j].noc == 2) {
        if (avail[i]) {
          avail[i]--;
          Ppl[j].allot = i;
        } else {
          Ppl[j].ch1++;
          Ppl[j].noc = 1;
        }
      }
    }
  }
  cout << "YES" << endl;
  map<int, string> M;
  M[0] = string("S");
  M[1] = string("M");
  M[2] = string("L");
  M[3] = string("XL");
  M[4] = string("XXL");
  M[5] = string("XXXL");
  for (int i = 0; i < n; i++) {
    cout << M[Ppl[i].allot] << endl;
  }
  return 0;
};
