#include <bits/stdc++.h>
using namespace std;
const int Dim = 1e5 + 5;
char cuv[Dim][10];
int n, s, m, l, xl, xxl, xxxl;
int ans[Dim];
int s_m, m_l, l_xl, xl_xxl, xxl_xxxl;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(), cout.tie();
  cin >> s >> m >> l >> xl >> xxl >> xxxl >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> cuv[i] + 1;
    if (strcmp(cuv[i] + 1, "S") == 0) --s, ans[i] = 1;
    if (strcmp(cuv[i] + 1, "M") == 0) --m, ans[i] = 2;
    if (strcmp(cuv[i] + 1, "L") == 0) --l, ans[i] = 3;
    if (strcmp(cuv[i] + 1, "XL") == 0) --xl, ans[i] = 4;
    if (strcmp(cuv[i] + 1, "XXL") == 0) --xxl, ans[i] = 5;
    if (strcmp(cuv[i] + 1, "XXXL") == 0) --xxxl, ans[i] = 6;
    if (s < 0 || m < 0 || l < 0 || xl < 0 || xxl < 0 || xxxl < 0) {
      cout << "NO\n";
      return 0;
    }
    if (strcmp(cuv[i] + 1, "S,M") == 0) ++s_m;
    if (strcmp(cuv[i] + 1, "M,L") == 0) ++m_l;
    if (strcmp(cuv[i] + 1, "L,XL") == 0) ++l_xl;
    if (strcmp(cuv[i] + 1, "XL,XXL") == 0) ++xl_xxl;
    if (strcmp(cuv[i] + 1, "XXL,XXXL") == 0) ++xxl_xxxl;
  }
  for (int i = 1; i <= n; ++i)
    if (s > 0 && strcmp(cuv[i] + 1, "S,M") == 0) ans[i] = 1, --s, --s_m;
  if (s_m != 0) {
    for (int i = 1; i <= n; ++i) {
      if (ans[i] == 0 && strcmp(cuv[i] + 1, "S,M") == 0) ans[i] = 2, --m;
      if (m < 0) {
        cout << "NO\n";
        return 0;
      }
    }
  }
  for (int i = 1; i <= n; ++i)
    if (m > 0 && strcmp(cuv[i] + 1, "M,L") == 0) ans[i] = 2, --m, --m_l;
  if (m_l != 0) {
    for (int i = 1; i <= n; ++i) {
      if (ans[i] == 0 && strcmp(cuv[i] + 1, "M,L") == 0) ans[i] = 3, --l;
      if (l < 0) {
        cout << "NO\n";
        return 0;
      }
    }
  }
  for (int i = 1; i <= n; ++i)
    if (l > 0 && strcmp(cuv[i] + 1, "L,XL") == 0) ans[i] = 3, --l, --l_xl;
  if (l_xl != 0) {
    for (int i = 1; i <= n; ++i) {
      if (ans[i] == 0 && strcmp(cuv[i] + 1, "L,XL") == 0) ans[i] = 4, --xl;
      if (xl < 0) {
        cout << "NO\n";
        return 0;
      }
    }
  }
  for (int i = 1; i <= n; ++i)
    if (xl > 0 && strcmp(cuv[i] + 1, "XL,XXL") == 0) ans[i] = 4, --xl, --xl_xxl;
  if (xl_xxl != 0) {
    for (int i = 1; i <= n; ++i) {
      if (ans[i] == 0 && strcmp(cuv[i] + 1, "XL,XXL") == 0) ans[i] = 5, --xxl;
      if (xxl < 0) {
        cout << "NO\n";
        return 0;
      }
    }
  }
  for (int i = 1; i <= n; ++i)
    if (xxl > 0 && strcmp(cuv[i] + 1, "XXL,XXXL") == 0)
      ans[i] = 5, --xxl, --xxl_xxxl;
  if (xxl_xxxl != 0) {
    for (int i = 1; i <= n; ++i) {
      if (ans[i] == 0 && strcmp(cuv[i] + 1, "XXL,XXXL") == 0)
        ans[i] = 6, --xxxl;
      if (xxxl < 0) {
        cout << "NO\n";
        return 0;
      }
    }
  }
  cout << "YES\n";
  for (int i = 1; i <= n; ++i) {
    if (ans[i] == 1) cout << "S\n";
    if (ans[i] == 2) cout << "M\n";
    if (ans[i] == 3) cout << "L\n";
    if (ans[i] == 4) cout << "XL\n";
    if (ans[i] == 5) cout << "XXL\n";
    if (ans[i] == 6) cout << "XXXL\n";
  }
  return 0;
}
