#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const int N = 1000000 + 10;
const int M = 1000;
const string st2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string s1 = "abcdefghijklmnopqrstuvwxyz";
pair<int, int> a[N];
int b[N];
string ans[N], da[N];
int main() {
  cin >> b[1] >> b[2] >> b[3] >> b[4] >> b[5] >> b[6];
  int n;
  cin >> n;
  da[1] = "S";
  da[2] = "M";
  da[3] = "L";
  da[4] = "XL";
  da[5] = "XXL";
  da[6] = "XXXL";
  for (int i = 1; i <= n; i++) {
    string second;
    cin >> second;
    if (second == "S")
      a[i] = make_pair(1, 0);
    else if (second == "M")
      a[i] = make_pair(2, 0);
    else if (second == "L")
      a[i] = make_pair(3, 0);
    else if (second == "XL")
      a[i] = make_pair(4, 0);
    else if (second == "XXL")
      a[i] = make_pair(5, 0);
    else if (second == "XXXL")
      a[i] = make_pair(6, 0);
    else if (second[0] == 'S')
      a[i] = make_pair(1, 1);
    else if (second[0] == 'M')
      a[i] = make_pair(2, 1);
    else if (second[0] == 'L')
      a[i] = make_pair(3, 1);
    else if (second[1] == 'L')
      a[i] = make_pair(4, 1);
    else if (second[2] == 'L')
      a[i] = make_pair(5, 1);
    else
      a[i] = make_pair(6, 1);
  }
  for (int i = 1; i <= n; i++)
    if (a[i].second == 0) {
      if (b[a[i].first] != 0) {
        ans[i] = da[a[i].first];
        b[a[i].first]--;
      }
    }
  for (int i = 1; i <= 6; i++) {
    for (int j = 1; j <= n; j++)
      if (ans[j] == "" && a[j].second == 1) {
        if (a[j].first + 1 == i && b[i] > 0) {
          b[i]--;
          ans[j] = da[i];
        }
      }
    for (int j = 1; j <= n; j++)
      if (ans[j] == "" && a[j].second == 1) {
        if (a[j].first == i && b[i] > 0) {
          b[i]--;
          ans[j] = da[i];
        }
      }
  }
  for (int i = 1; i <= n; i++)
    if (ans[i] == "") {
      cout << "NO" << endl;
      return 0;
    }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) cout << ans[i] << endl;
}
