func_code_string: #include <bits/stdc++.h>   using namespace std;   const int adj[8][2] = {{-1, 0},  {0, -1}, {1, 0}, {0, 1},                          {-1, -1}, {-1, 1}, {1, 1}, {1, -1}};   const long long int LLINF = 9e18;   const int INF = 2e9;   const int MOD = 1e9 + 7;   const double EPS = 1e-10;   const double PI = acos(-1);   const int SIZE = 100011;   int N;   int cnt[SIZE];   map<string, int> Mp;   string ts[8] = { S ,  M ,  L ,  XL ,  XXL ,  XXXL };   string s;   struct edge {     int v, f, c, u;   };   vector<edge> E[SIZE];   int st[SIZE], lvl[SIZE];   void init() {     for (int i = 0; i < SIZE; i++) {       cnt[i] = 0;       E[i].clear();     }   }   void addedge(int a, int b, int ca, int cb) {     edge A = {a, 0, ca, (int)E[a].size()};     edge B = {b, 0, cb, (int)E[b].size()};     E[a].push_back(B);     E[b].push_back(A);   }   bool BFS(int S, int T) {     memset(lvl, -1, sizeof(lvl));     queue<int> q;     q.push(S);     lvl[S] = 0;     while (!q.empty()) {       int indx = q.front();       q.pop();       for (unsigned int i = 0; i < E[indx].size(); i++) {         edge &t = E[indx][i];         int idx = t.v;         if (lvl[idx] < 0 && t.c > t.f) {           lvl[idx] = lvl[indx] + 1;           q.push(idx);         }       }     }     return lvl[T] >= 0;   }   int DFS(int indx, int T, int flow) {     if (indx == T) return flow;     for (int &i = st[indx]; i < (int)E[indx].size(); i++) {       edge &t = E[indx][i];       int idx = t.v;       if (lvl[idx] == lvl[indx] + 1 && t.c > t.f) {         int cur = min(flow, t.c - t.f);         int ret = DFS(idx, T, cur);         if (ret > 0) {           t.f += ret;           E[t.v][t.u].f -= ret;           return ret;         }       }     }     return 0;   }   int Dinic(int S, int T) {     int ret = 0;     while (BFS(S, T)) {       memset(st, 0, sizeof(st));       while (int flow = DFS(S, T, INF)) {         ret += flow;       }     }     return ret;   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int S = 0, T = SIZE - 1, a;     init();     for (int i = 1; i <= 6; i++) {       cin >> a;       Mp[ts[i - 1]] = i;       addedge(i, T, 0, a);     }     cin >> N;     for (int i = 1; i <= N; i++) {       cin >> s;       s +=  , ;       string temp =   ;       for (unsigned int j = 0; j < s.size(); j++) {         if (s[j] ==  , ) {           addedge(i + 6, Mp[temp], 0, 1);           temp.clear();           cnt[i + 6]++;         } else           temp.push_back(s[j]);       }       addedge(S, i + 6, 0, 1);     }     int ans = Dinic(S, T);     if (ans != N)       cout <<  NO  << endl;     else {       cout <<  YES  << endl;       for (int i = 1; i <= N; i++) {         edge t1, t2;         if (cnt[i + 6] == 1) {           t1 = E[i + 6][0];           cout << ts[t1.v - 1] << endl;         } else {           t1 = E[i + 6][0];           t2 = E[i + 6][1];           if (t1.f == 1)             cout << ts[t1.v - 1] << endl;           else if (t2.f == 1)             cout << ts[t2.v - 1] << endl;         }       }     }     return 0;   }   