func_code_string: #include <bits/stdc++.h>   using namespace std;   struct node {     int a;     int b;     int idx;     int k;     int actor;     node() {}     node(int a, int b, int idx, int k, int actor)         : a(a), b(b), idx(idx), k(k), actor(actor) {}   };   const int MAXN = (int)1e5 + 5;   set<node> s;   vector<node> v;   int res[MAXN];   bool operator<(const node &x, const node &y) {     return x.b < y.b || (x.b == y.b && x.idx < y.idx);   }   bool comp(const node &x, const node &y) {     return x.a < y.a || (x.a == y.a && x.actor > y.actor);   }   int main(void) {     int n, m;     int a, b;     int c, d, k;     scanf(  %d , &n);     for (int i = 0; i < n; i++) {       scanf(  %d %d , &a, &b);       v.push_back(node(a, b, i, 0, 0));     }     scanf(  %d , &m);     for (int i = 1; i <= m; i++) {       scanf(  %d %d %d , &c, &d, &k);       v.push_back(node(c, d, i, k, 1));     }     sort(v.begin(), v.end(), comp);     int ok = 1;     for (int i = 0; i < (int)v.size(); i++) {       a = v[i].a;       b = v[i].b;       k = v[i].k;       int idx = v[i].idx;       int actor = v[i].actor;       if (actor) {         s.insert(v[i]);       } else {         v[i].idx = 0;         set<node>::iterator it = s.lower_bound(v[i]);         if (it == s.end()) {           ok = 0;         } else {           node aux = *it;           res[idx] = aux.idx;           s.erase(it);           aux.k--;           if (aux.k > 0) {             s.insert(aux);           }         }       }     }     if (ok) {       printf( YES n );       for (int i = 0; i < n; i++) {         if (i != 0) {           printf(   );         }         printf( %d , res[i]);       }     } else {       printf( NO n );     }     return 0;   }   