#include <bits/stdc++.h>
using namespace std;
map<string, int> aids = {{"S", 0},  {"M", 1},   {"L", 2},
                         {"XL", 3}, {"XXL", 4}, {"XXXL", 5}};
map<int, string> aids4 = {{0, "S"},  {1, "M"},   {2, "L"},
                          {3, "XL"}, {4, "XXL"}, {5, "XXXL"}};
map<string, int> aids2 = {
    {"S,M", 0}, {"M,L", 1}, {"L,XL", 2}, {"XL,XXL", 3}, {"XXL,XXXL", 4}};
map<int, string> aids5 = {
    {0, "S,M"}, {1, "M,L"}, {2, "L,XL"}, {3, "XL,XXL"}, {4, "XXL,XXXL"}};
int ct[6];
int nq[5];
vector<int> aids3[5];
string ans[100005];
int main() {
  ios::sync_with_stdio(false);
  for (int i = 0; i < 6; i++) {
    int x;
    cin >> x;
    ct[i] = x;
  }
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    string st;
    cin >> st;
    for (int j = 0; j < 6; j++) {
      if (aids4[j] == st) {
        if (ct[aids[st]] == 0) {
          cout << "NO" << endl;
          return 0;
        }
        ct[aids[st]]--;
        ans[i] = st;
      }
    }
    for (int j = 0; j < 5; j++) {
      if (aids5[j] == st) {
        nq[aids2[st]]++;
        aids3[j].push_back(i);
      }
    }
  }
  int rp = 0;
  for (int i = 0; i < 5; i++) {
    if (ct[i] - rp < 0) {
      cout << "NO" << endl;
      return 0;
    }
    for (int j = 0; j < rp; j++) {
      ans[aids3[i - 1][j]] = aids4[i];
    }
    ct[i] -= rp;
    rp = abs(min(0, ct[i] - nq[i]));
    for (int j = 0; j < min(ct[i], nq[i]); j++) {
      ans[aids3[i][aids3[i].size() - j - 1]] = aids4[i];
    }
    for (int j = 0; j < min(ct[i], nq[i]); j++) {
      aids3[i].erase(aids3[i].end() - 1);
    }
  }
  if (rp > ct[5]) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  for (int i = 0; i < N; i++) {
    if (ans[i] == "") {
      cout << "XXXL" << endl;
      continue;
    }
    cout << ans[i] << endl;
  }
  return 0;
}
