#include <bits/stdc++.h>
using namespace std;
int n;
int arr[7];
string ans[200005];
string str[] = {"S",   "M",   "L",    "XL",     "XXL",     "XXXL",
                "S,M", "M,L", "L,XL", "XL,XXL", "XXL,XXXL"};
vector<int> v[7];
int main() {
  for (int i = 0; i <= 5; ++i) {
    cin >> arr[i];
  }
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    string s;
    cin >> s;
    for (int j = 0; j <= 10; ++j) {
      if (j < 6) {
        if (s == str[j]) {
          --arr[j];
          ans[i] = str[j];
        }
      } else {
        if (s == str[j]) {
          v[j - 6].push_back(i);
        }
      }
    }
  }
  for (int i = 0; i <= 5; ++i) {
    if (arr[i] < 0) {
      cout << "NO";
      return 0;
    }
  }
  for (int j = 6; j <= 10; ++j) {
    int sz = v[j - 6].size();
    for (int i = 0; i <= sz - 1; ++i) {
      if (arr[j - 6] > 0) {
        --arr[j - 6];
        ans[v[j - 6][i]] = str[j - 6];
      } else if (arr[j + 1 - 6] > 0) {
        --arr[j + 1 - 6];
        ans[v[j - 6][i]] = str[j + 1 - 6];
      } else {
        cout << "NO";
        return 0;
      }
    }
  }
  cout << "YES\n";
  for (int i = 1; i <= n; ++i) {
    cout << ans[i] << "\n";
  }
  return 0;
}
