func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m;   int ans[100100];   struct by {     int l, r, id, i, num;   } a[100100 * 2];   bool cmp(by a, by b) {     if (a.r != b.r) return a.r < b.r;     return a.id < b.id;   }   struct byy {     int i, l;     byy() {}     byy(int i, int l) : i(i), l(l) {}     bool operator<(const byy &rhs) const {       if (l != rhs.l) return l < rhs.l;       return i < rhs.i;     }   };   set<byy> s;   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d%d , &a[i].l, &a[i].r);       a[i].i = i;       a[i].id = 0;     }     scanf( %d , &m);     for (int i = 1; i <= m; i++) {       scanf( %d%d%d , &a[i + n].l, &a[i + n].r, &a[i + n].num);       a[i + n].i = i;       a[i + n].id = 1;     }     sort(a + 1, a + m + n + 1, cmp);     int cnt = 0;     for (int i = 1; i <= m + n; i++) {       if (!a[i].id)         s.insert(byy(a[i].i, a[i].l));       else {         while (s.size() && a[i].num--) {           set<byy>::iterator p = s.lower_bound(byy(0, a[i].l));           if (p == s.end()) break;           byy now = *p;           s.erase(p);           ans[now.i] = a[i].i;           cnt++;         }       }     }     if (cnt == n) {       printf( YES n );       for (int i = 1; i <= n; i++) printf( %d  , ans[i]);       printf(  n );     } else       printf( NO n );     return 0;   }   