#include <bits/stdc++.h>   using namespace std;   bool can(bool print, int t, long long S, const vector<pair<int, int> >& bugs,            const vector<pair<int, pair<int, int> > >& st) {     priority_queue<pair<int, int>, vector<pair<int, int> >,                    greater<pair<int, int> > >         pq;     int ind = bugs.size() - 1;     int stind = st.size() - 1;     vector<int> ans(bugs.size());     long long cost = 0;     while (ind >= 0) {       while (stind >= 0 and st[stind].first >= bugs[ind].first) {         pq.push(pair<int, int>(st[stind].second.first, st[stind].second.second));         --stind;       }       if (pq.empty()) return false;       long long c = pq.top().first;       int indans = pq.top().second;       pq.pop();       cost += c;       if (cost > S) return false;       for (int i = 0; ind >= 0 and i < t; ++i) {         ans[bugs[ind].second] = indans;         --ind;       }     }     if (print) {       for (int i = 0; i < int(bugs.size()); ++i) cout << (i ?     :   ) << ans[i];       cout << endl;     }     return true;   }   int main() {     int n, m, s;     cin >> n >> m >> s;     vector<pair<int, int> > bugs(m);     for (int i = 0; i < m; ++i) {       cin >> bugs[i].first;       bugs[i].second = i;     }     vector<pair<int, pair<int, int> > > st(n);     for (int i = 0; i < n; ++i) cin >> st[i].first;     for (int i = 0; i < n; ++i) {       cin >> st[i].second.first;       st[i].second.second = i + 1;     }     sort(bugs.begin(), bugs.end());     sort(st.begin(), st.end());     int low = 1, hi = m + 1;     while (low < hi) {       int mid = (low + hi) / 2;       if (can(false, mid, s, bugs, st))         hi = mid;       else         low = mid + 1;     }     if (low == m + 1)       cout <<  NO  << endl;     else {       cout <<  YES  << endl;       can(true, low, s, bugs, st);     }   }   