#include <bits/stdc++.h>
using namespace std;
map<string, int> MP;
int ans[100005];
string str[100005];
int cnt[8];
int n;
bool ret(string str, int x) {
  str = str.substr(0, str.find(","));
  if (MP[str] == x) return 1;
  return 0;
}
bool solve() {
  for (int i = 1; i <= 6; i++) cin >> cnt[i];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> str[i];
    if (str[i].find(",") != string::npos) {
      ans[i] = 0;
    } else {
      ans[i] = MP[str[i]];
      cnt[MP[str[i]]]--;
      if (cnt[MP[str[i]]] < 0) return false;
    }
  }
  for (int x = 1; x <= 6; x++) {
    int i = 0;
    while (cnt[x] > 0 && i < n) {
      if (ans[i] == 0 && ret(str[i], x - 1)) {
        ans[i] = x;
        cnt[x]--;
      }
      i++;
    }
    i = 0;
    while (cnt[x] > 0 && i < n) {
      if (ans[i] == 0 && ret(str[i], x)) {
        ans[i] = x;
        cnt[x]--;
      }
      i++;
    }
  }
  for (int i = 0; i < n; ++i) {
    if (ans[i] == 0) return false;
  }
  return true;
}
int main() {
  MP["S"] = 1, MP["M"] = 2, MP["L"] = 3, MP["XL"] = 4, MP["XXL"] = 5,
  MP["XXXL"] = 6;
  if (solve()) {
    cout << "YES\n";
    for (int i = 0; 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";
    }
  } else
    cout << "NO\n";
}
