func_code_string: #include <bits/stdc++.h>   using namespace std;   int cnt[6], ans[100001];   pair<int, int> arr[100001];   bool given[100001];   string tshirt[6] = { S ,  M ,  L ,  XL ,  XXL ,  XXXL };   int match(string s) {     for (int i = 0; i < 6; i++) {       if (tshirt[i] == s) return i;     }   }   void convert(int ind, string s) {     string tmp;     bool flag = 0;     for (int i = 0; i < s.size(); i++) {       if (s[i] ==  , ) {         flag = 1;         arr[ind].first = match(tmp);         tmp.clear();       } else         tmp.push_back(s[i]);     }     if (flag) {       arr[ind].second = match(tmp);       if (arr[ind].first > arr[ind].second) swap(arr[ind].first, arr[ind].second);     } else {       arr[ind].first = match(tmp);       arr[ind].second = -1;     }     return;   }   bool cal_ans(int n) {     for (int i = 0; i < n; i++) {       if (arr[i].second == -1) {         if (cnt[arr[i].first] == 0) return false;         ans[i] = arr[i].first;         cnt[arr[i].first]--;         given[i] = 1;       }     }     for (int j = 0; j < 5; j++) {       for (int i = 0; i < n; i++) {         if (given[i] == 0 and arr[i].first == j) {           if (cnt[arr[i].first]) {             cnt[arr[i].first]--;             ans[i] = j;           } else {             if (cnt[arr[i].second]) {               cnt[arr[i].second]--;               ans[i] = arr[i].second;             } else               return false;           }           given[i] = 1;         }       }     }     return 1;   }   int main() {     ios::sync_with_stdio(false);     for (int i = 0; i < 6; i++) cin >> cnt[i];     int n;     cin >> n;     string s;     for (int i = 0; i < n; i++) {       cin >> s;       convert(i, s);     }     if (cal_ans(n)) {       cout <<  YES n ;       for (int i = 0; i < n; i++) {         cout << tshirt[ans[i]] << endl;       }     } else {       cout <<  NO ;     }   }   