#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 17;
int n, a[6];
vector<int> g[N];
map<string, int> mp;
string s[N], res[N];
string str[11] = {"S", "M", "L", "XL", "XXL", "XXXL"};
void Init() {
  for (int i = 0; i < 5; i++) str[i + 6] = str[i] + ',' + str[i + 1];
  for (int i = 0; i < 11; i++) mp[str[i]] = i;
}
int main() {
  Init();
  for (int i = 0; i < 6; i++) scanf("%d", a + i);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    g[mp[s[i]]].push_back(i);
  }
  for (int i = 0; i < 6; i++)
    for (int j = 0; j < g[i].size(); j++)
      if (!a[i]) {
        puts("NO");
        return 0;
      } else
        a[i]--, res[g[i][j]] = str[i];
  for (int i = 6; i < 11; i++)
    for (int j = 0; j < g[i].size(); j++)
      if (a[i - 6])
        a[i - 6]--, res[g[i][j]] = str[i - 6];
      else if (a[i - 5])
        a[i - 5]--, res[g[i][j]] = str[i - 5];
      else {
        puts("NO");
        return 0;
      }
  puts("YES");
  for (int i = 0; i < n; i++) cout << res[i] << endl;
}
