#include <bits/stdc++.h>
using namespace std;
int large[5];
map<string, int> toint;
string tostr[6];
int main() {
  ios::sync_with_stdio(false);
  toint["S"] = 0;
  toint["M"] = 1;
  toint["L"] = 2;
  toint["XL"] = 3;
  toint["XXL"] = 4;
  toint["XXXL"] = 5;
  toint["S,M"] = 6;
  toint["M,L"] = 7;
  toint["L,XL"] = 8;
  toint["XL,XXL"] = 9;
  toint["XXL,XXXL"] = 10;
  tostr[0] = "S";
  tostr[1] = "M";
  tostr[2] = "L";
  tostr[3] = "XL";
  tostr[4] = "XXL";
  tostr[5] = "XXXL";
  int sizes[6];
  cin >> sizes[0] >> sizes[1] >> sizes[2] >> sizes[3] >> sizes[4] >> sizes[5];
  int n = 0;
  cin >> n;
  int type[n];
  for (int i = 0; i < n; ++i) {
    type[i] = -1;
  }
  for (int i = 0; i < n; ++i) {
    string s;
    string a = "-", b = "-";
    cin >> s;
    int temp = toint[s];
    type[i] = temp;
    if (temp > 5) {
      ++large[temp - 6];
    } else {
      --sizes[temp];
    }
  }
  int numbers[10];
  for (int i = 0; i < 10; ++i) {
    numbers[i] = -1;
  }
  numbers[9] = sizes[5];
  large[4] -= min(sizes[5], large[4]);
  numbers[8] = large[4];
  numbers[7] = sizes[4];
  sizes[4] -= large[4];
  large[3] -= min(sizes[4], large[3]);
  if (sizes[4] < 0) {
    cout << "NO\n";
    return 0;
  }
  numbers[6] = large[3];
  numbers[5] = sizes[3];
  sizes[3] -= large[3];
  large[2] -= min(sizes[3], large[2]);
  if (sizes[3] < 0) {
    cout << "NO\n";
    return 0;
  }
  numbers[4] = large[2];
  numbers[3] = sizes[2];
  sizes[2] -= large[2];
  large[1] -= min(sizes[2], large[1]);
  if (sizes[2] < 0) {
    cout << "NO\n";
    return 0;
  }
  numbers[2] = large[1];
  numbers[1] = sizes[1];
  sizes[1] -= large[1];
  large[0] -= min(sizes[1], large[0]);
  if (sizes[1] < 0) {
    cout << "NO\n";
    return 0;
  }
  numbers[0] = large[0];
  sizes[0] -= large[0];
  if (sizes[0] < 0) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    for (int i = 0; i < n; ++i) {
      if (type[i] < 6) {
        cout << tostr[type[i]] << "\n";
      } else {
        if (numbers[(type[i] - 6) * 2] != 0) {
          numbers[(type[i] - 6) * 2]--;
          cout << tostr[type[i] - 6] << "\n";
        } else {
          numbers[(type[i] - 6) * 2 + 1]--;
          cout << tostr[type[i] - 5] << "\n";
        }
      }
    }
  }
  return 0;
}
