#include <bits/stdc++.h>
using namespace std;
int G[35][35];
bool visit[35];
int rute[35];
map<string, int> isi, jum, conv;
string nama[35];
vector<int> arah[35], adj[35];
string hasil[100005];
queue<int> pos;
void connect(int u, int v, int flow) {
  adj[u].push_back(v);
  G[u][v] += flow;
}
int augment(int u, int minflow, int &source) {
  if (u == source) return minflow;
  int v = rute[u];
  if (v == -1) return -1;
  int h = augment(v, min(minflow, G[v][u]), source);
  G[v][u] -= h;
  G[u][v] += h;
  return h;
}
int mf(int S, int T) {
  int ret = 0;
  while (1) {
    memset(visit, 0, sizeof(visit));
    memset(rute, -1, sizeof(rute));
    while (!pos.empty()) pos.pop();
    pos.push(S);
    while (!pos.empty()) {
      int u = pos.front();
      pos.pop();
      for (int z = 0; z < adj[u].size(); z++) {
        int v = adj[u][z];
        if (G[u][v] <= 0) continue;
        if (visit[v]) continue;
        visit[v] = 1;
        rute[v] = u;
        pos.push(v);
        if (v == T) {
          u = T;
          break;
        }
      }
      if (u == T) break;
    }
    int h = augment(T, 1e9, S);
    if (h == -1) break;
    ret += h;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  isi["S"] = 20;
  nama[20] = "S";
  isi["M"] = 21;
  nama[21] = "M";
  isi["L"] = 22;
  nama[22] = "L";
  isi["XL"] = 23;
  nama[23] = "XL";
  isi["XXL"] = 24;
  nama[24] = "XXL";
  isi["XXXL"] = 25;
  nama[25] = "XXXL";
  for (int a = 20; a <= 25; a++) {
    int inp;
    cin >> inp;
    connect(a, 30, inp);
    connect(30, a, 0);
  }
  int n;
  cin >> n;
  string S;
  int ix = 1;
  for (int a = 0; a < n; a++) {
    cin >> S;
    if (conv.count(S) == 0) conv[S] = ix++;
    arah[conv[S]].push_back(a);
    jum[S]++;
  }
  for (map<string, int>::iterator it = jum.begin(); it != jum.end(); it++) {
    string tmp = "";
    connect(0, conv[it->first], it->second);
    connect(conv[it->first], 0, 0);
    for (int a = 0; a < (it->first).size(); a++) {
      if (isalpha((it->first)[a])) {
        tmp.push_back((it->first)[a]);
      } else {
        connect(conv[it->first], isi[tmp], it->second);
        connect(isi[tmp], conv[it->first], 0);
        tmp = "";
      }
    }
    connect(conv[it->first], isi[tmp], it->second);
    connect(isi[tmp], conv[it->first], 0);
  }
  int out = mf(0, 30);
  if (out != n) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
    for (int a = 20; a <= 25; a++) {
      for (int b = 1; b < ix; b++) {
        for (int c = 0; c < G[a][b]; c++) {
          hasil[(int)arah[b].back()] = nama[a];
          arah[b].pop_back();
        }
      }
    }
    for (int a = 0; a < n; a++) {
      cout << hasil[a] << endl;
    }
  }
  return 0;
}
