#include <bits/stdc++.h>
using namespace std;
void Read(int &x) {
  char c;
  while (c = getchar(), c != EOF)
    if (c >= '0' && c <= '9') {
      x = c - '0';
      while (c = getchar(), c >= '0' && c <= '9') x = x * 10 + c - '0';
      ungetc(c, stdin);
      return;
    }
}
int n;
char ss[7][20] = {"", "S", "M", "L", "XL", "XXL", "XXXL"};
struct node {
  int v, cap;
  node *back, *next;
} * adj[10000], edge[10000], *ecnt = edge;
void addedge(int u, int v, int cap) {
  node *p = ++ecnt;
  p->v = v;
  p->cap = cap;
  p->next = adj[u];
  adj[u] = p;
  p = p->back = ++ecnt;
  p->v = u;
  p->cap = 0;
  p->next = adj[v];
  adj[v] = p;
  p->back = ecnt - 1;
}
int S = 12, T, tot = T = 13, cap[20], dist[20], vd[20];
inline int f(char *s) {
  if (*s == 'S') {
    return s[1] ? 7 : 1;
  }
  if (*s == 'M') return s[1] ? 8 : 2;
  if (*s == 'L') return s[1] ? 9 : 3;
  if (s[1] == 'L') return s[2] ? 10 : 4;
  if (s[2] == 'L') return s[3] ? 11 : 5;
  return 6;
}
int dfs(int u, int augu) {
  if (u == T) return augu;
  int augv = 0, v, delta, mind = tot - 1;
  for (node *p = adj[u]; p; p = p->next)
    if (p->cap) {
      v = p->v;
      if (dist[u] == dist[v] + 1) {
        delta = min(augu - augv, p->cap);
        delta = dfs(v, delta);
        augv += delta;
        p->cap -= delta;
        p->back->cap += delta;
        if (augu == augv || dist[S] >= tot) return augv;
      }
      mind = min(dist[v], mind);
    }
  if (!augv) {
    if (!--vd[dist[u]]) dist[S] = tot;
    vd[dist[u] = mind + 1]++;
  }
  return augv;
}
char s[100000 + 10][20];
int sap() {
  int flow = 0;
  vd[0] = tot;
  while (dist[S] < tot) flow += dfs(S, 0x7fffffff);
  return flow;
}
void read() {
  int i, wt;
  for (i = 1; i <= 6; i++) {
    Read(wt);
    addedge(i, T, wt);
  }
  for (i = 1; i < 6; i++) {
    addedge(i + 6, i, 0x7fffffff);
    addedge(i + 6, i + 1, 0x7fffffff);
  }
  Read(n);
  for (i = 1; i <= n; i++) {
    scanf("%s", s[i]);
    cap[f(s[i])]++;
  }
  for (i = 1; i <= 11; i++) addedge(S, i, cap[i]);
}
void solve() {
  if (sap() != n) {
    puts("NO");
    exit(0);
  }
  puts("YES");
  int i;
  for (i = 1; i <= n; i++)
    if (f(s[i]) <= 6)
      puts(s[i]);
    else {
      int t = f(s[i]);
      for (node *p = adj[t]; p; p = p->next)
        if (p->v <= 6) {
          if (p->back->cap) {
            puts(ss[p->v]);
            p->back->cap--;
            break;
          }
        }
    }
}
int main() {
  read();
  solve();
}
