#include <bits/stdc++.h>
using namespace std;
const string Sizes[] = {"S",   "M",   "L",    "XL",     "XXL",     "XXXL",
                        "S,M", "M,L", "L,XL", "XL,XXL", "XXL,XXXL"};
int main() {
  int Num[6], NPeople;
  int Num_BU[6];
  cin >> Num[0] >> Num[1] >> Num[2] >> Num[3] >> Num[4] >> Num[5];
  cin >> NPeople;
  for (int index = 0; index < 6; index++) {
    Num_BU[index] = Num[index];
  }
  vector<int> Requests;
  string strval;
  for (int index = 0; index < NPeople; index++) {
    cin >> strval;
    for (int index2 = 0; index2 < 11; index2++) {
      if (strval == Sizes[index2]) {
        Requests.push_back(index2);
        break;
      }
    }
  }
  int NumRequest;
  int *Answer = new int[NPeople];
  for (int index = 0; index < 6; index++) {
    Num[index] -= count(Requests.begin(), Requests.end(), index);
    if (Num[index] < 0) {
      cout << "NO" << endl;
      exit(0);
    }
    for (int index2 = 0; index2 < NPeople; index2++) {
      if (Requests[index2] == index) {
        Answer[index2] = index;
      }
    }
  }
  for (int index = 6; index < 11; index++) {
    NumRequest = count(Requests.begin(), Requests.end(), index);
    if (Num[(index - 6)] >= NumRequest) {
      for (int index2 = 0; index2 < NPeople; index2++) {
        if (Requests[index2] == index) {
          Answer[index2] = index - 6;
        }
      }
    } else {
      for (int index2 = 0; index2 < NPeople; index2++) {
        if (Requests[index2] == index && Num[index - 6] > 0) {
          Answer[index2] = index - 6;
          Num[index - 6]--;
        } else if (Requests[index2] == index && Num[index - 5] > 0) {
          Answer[index2] = index - 5;
          Num[index - 5]--;
        } else if (Requests[index2] == index && Num[index - 5] <= 0) {
          cout << "NO" << endl;
          exit(0);
        }
      }
    }
  }
  cout << "YES" << endl;
  for (int index = 0; index < NPeople; index++) {
    cout << Sizes[Answer[index]] << endl;
  }
  delete[] Answer;
  return 0;
}
