#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int rec[maxn];
int v[maxn];
int main() {
  ios::sync_with_stdio(false);
  for (int i = 0; i < 6; i++) {
    cin >> v[i];
  }
  int n;
  cin >> n;
  vector<pair<int, int> > mult;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (s == "S") {
      rec[i] = 0;
      v[0]--;
    } else if (s == "M") {
      rec[i] = 1;
      v[1]--;
    } else if (s == "L") {
      rec[i] = 2;
      v[2]--;
    } else if (s == "XL") {
      rec[i] = 3;
      v[3]--;
    } else if (s == "XXL") {
      rec[i] = 4;
      v[4]--;
    } else if (s == "XXXL") {
      rec[i] = 5;
      v[5]--;
    } else {
      if (s[0] == 'S') {
        mult.push_back(make_pair(0, i));
      } else if (s[0] == 'M') {
        mult.push_back(make_pair(1, i));
      } else if (s[0] == 'L') {
        mult.push_back(make_pair(2, i));
      } else if (s[1] == 'L') {
        mult.push_back(make_pair(3, i));
      } else if (s[2] == 'L') {
        mult.push_back(make_pair(4, i));
      } else if (s[3] == 'L') {
        mult.push_back(make_pair(5, i));
      }
    }
  }
  sort(mult.begin(), mult.end());
  for (int i = 0; i < mult.size(); i++) {
    if (v[mult[i].first]) {
      rec[mult[i].second] = mult[i].first;
      v[mult[i].first]--;
    } else if (v[mult[i].first + 1]) {
      rec[mult[i].second] = mult[i].first + 1;
      v[mult[i].first + 1]--;
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }
  for (int i = 0; i < 6; i++) {
    if (v[i] < 0) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) {
    if (rec[i] == 0) {
      cout << "S" << endl;
    } else if (rec[i] == 1) {
      cout << "M" << endl;
    } else if (rec[i] == 2) {
      cout << "L" << endl;
    } else if (rec[i] == 3) {
      cout << "XL" << endl;
    } else if (rec[i] == 4) {
      cout << "XXL" << endl;
    } else if (rec[i] == 5) {
      cout << "XXXL" << endl;
    }
  }
  return 0;
}
