#include <bits/stdc++.h>
using namespace std;
char s1[5][10] = {"S,M", "M,L", "L,XL", "XL,XXL", "XXL,XXXL"};
char s2[6][10] = {"S", "M", "L", "XL", "XXL", "XXXL"};
char s3[100005][10];
int cnt[6];
int main() {
  for (int i = 0; i < 6; i++) cin >> cnt[i];
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s3[i]);
    for (int j = 0; j < 6; j++) {
      if (strcmp(s3[i], s2[j]) == 0) {
        cnt[j]--;
        break;
      }
    }
  }
  for (int i = 0; i < 6; i++) {
    if (cnt[i] < 0) {
      cout << "NO";
      return 0;
    }
  }
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < n; j++) {
      if (strcmp(s1[i], s3[j]) == 0) {
        if (cnt[i] > 0) {
          cnt[i]--;
          strcpy(s3[j], s2[i]);
        } else if (cnt[i + 1] > 0) {
          cnt[i + 1]--;
          strcpy(s3[j], s2[i + 1]);
        } else {
          cout << "NO" << endl;
          return 0;
        }
      }
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) cout << s3[i] << endl;
  return 0;
}
