func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> a;   vector<pair<pair<int, int>, int> > b;   vector<int> k;   vector<int> ans;   signed main() {     ios_base::sync_with_stdio(0);     int n, m;     cin >> n;     a.resize(n);     b.resize(n);     ans.resize(n);     for (int i = 0; i < n; i++) {       cin >> b[i].first.first >> b[i].second;     }     cin >> m;     b.resize(n + m);     k.resize(m);     for (int i = 0; i < n; i++) {       b[i].first.second = i + m;     }     for (int i = n; i < m + n; i++) {       cin >> b[i].first.first >> b[i].second >> k[i - n];       b[i].first.second = i - n;     }     sort(b.begin(), b.end());     set<pair<int, int> > d;     bool poss = true;     for (int i = 0; i < n + m; i++) {       if (b[i].first.second < m)         d.insert(make_pair(b[i].second, b[i].first.second));       else {         set<pair<int, int> >::iterator it =             d.upper_bound(make_pair(b[i].second - 1, m));         if (it == d.end()) {           poss = false;           continue;         }         k[it->second]--;         ans[b[i].first.second - m] = it->second + 1;         if (k[it->second] == 0) d.erase(it);       }     }     if (poss) {       cout <<  YES  << endl;       for (int i = 0; i < n; i++) {         cout << ans[i] <<    ;       }       cout << endl;     } else       cout <<  NO  << endl;     return 0;   }   