#include <bits/stdc++.h>
using namespace std;
int main() {
  string re[6] = {"S", "M", "L", "XL", "XXL", "XXXL"};
  string r[5];
  for (int i = 0; i < 5; i++) r[i] = re[i] + "," + re[i + 1];
  vector<int> s(6);
  for (int(i) = 0; (i) < (int)(6); ++(i)) cin >> s[i];
  int n, i;
  cin >> n;
  vector<string> sol(n);
  vector<string> ss(n);
  for (int(i) = 0; (i) < (int)(n); ++(i)) {
    cin >> ss[i];
    for (int(j) = 0; (j) < (int)(6); ++(j))
      if (re[j] == ss[i]) {
        --s[j];
        sol[i] = re[j];
        break;
      }
  }
  for (int(i) = 0; (i) < (int)(6); ++(i))
    if (s[i] < 0) {
      cout << "NO";
      return 0;
    }
  for (int(j) = 0; (j) < (int)(5); ++(j))
    for (int(i) = 0; (i) < (int)(n); ++(i)) {
      string tmp = ss[i];
      if (tmp != r[j]) continue;
      if (s[j] > 0) {
        --s[j];
        sol[i] = re[j];
        continue;
      }
      if (s[j + 1] > 0) {
        --s[j + 1];
        sol[i] = re[j + 1];
        continue;
      }
      cout << "NO";
      return 0;
    }
  cout << "YES" << endl;
  for (int i = 0; i < sol.size(); i++) cout << sol[i] << endl;
  return 0;
}
