#include <bits/stdc++.h>
using namespace std;
int ji[100005];
struct node1 {
  int l, r, id;
} g[100005];
struct node2 {
  int l, r, c, id;
} r[100005];
bool cmp1(node1 a, node1 b) { return a.r < b.r; }
bool cmp2(node2 a, node2 b) { return a.r < b.r; }
int main() {
  int a, b, m, n, i, j;
  set<pair<int, int> > S;
  set<pair<int, int> >::iterator it;
  while (~scanf("%d", &a)) {
    memset(ji, 0, sizeof(ji));
    S.clear();
    for (m = 0; m < a; m++) {
      scanf("%d%d", &g[m].l, &g[m].r);
      g[m].id = m + 1;
    }
    sort(g, g + a, cmp1);
    scanf("%d", &b);
    for (m = 0; m < b; m++) {
      scanf("%d%d%d", &r[m].l, &r[m].r, &r[m].c);
      r[m].id = m + 1;
    }
    sort(r, r + b, cmp2);
    i = j = 0;
    for (m = 0; m < b; m++) {
      while (j < a && g[j].r <= r[m].r) {
        S.insert(make_pair(g[j].l, g[j].id));
        j++;
      }
      for (n = 0; n < r[m].c; n++) {
        it = S.lower_bound(make_pair(r[m].l, -1));
        if (it == S.end()) break;
        ji[(*it).second] = r[m].id;
        S.erase(it);
        i++;
      }
    }
    if (i < a)
      printf("NO\n");
    else {
      for (m = 1; m <= a; m++) {
        if (m == 1)
          printf("YES\n%d", ji[m]);
        else
          printf(" %d", ji[m]);
      }
      printf("\n");
    }
  }
  return 0;
}
