#include <bits/stdc++.h>
using namespace std;
struct part {
  int l, r, id, num;
  bool operator<(const part x) const {
    if (r != x.r) return r < x.r;
    if (l != x.l) return l > x.l;
    if (num != x.num) return num < x.num;
    return id < x.id;
  }
};
struct peo {
  int l, r, id;
  bool operator<(const peo x) const {
    if (l != x.l) return l < x.l;
    if (r != x.r) return r > x.r;
    return id < x.id;
  }
};
set<peo> PE;
part a[200005];
peo b;
int v[100005];
int k[100006];
int main() {
  int n, m;
  int i, j;
  int x, y, z;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &x, &y);
    a[i].l = x;
    a[i].r = y;
    a[i].id = i, a[i].num = 0;
  }
  scanf("%d", &m);
  for (i = n + 1; i <= m + n; i++) {
    scanf("%d%d%d", &x, &y, &z);
    a[i].l = x;
    a[i].r = y;
    a[i].id = i - n, a[i].num = z;
  }
  sort(a + 1, a + 1 + n + m);
  for (i = 1; i <= n + m; i++) {
    if (a[i].num == 0) {
      b.l = a[i].l;
      b.r = a[i].r;
      b.id = a[i].id;
      PE.insert(b);
    } else {
      b.l = a[i].l;
      b.r = a[i].r;
      b.id = 0;
      set<peo>::iterator iter = PE.lower_bound(b);
      int t = 0;
      for (; iter != PE.end() && t < a[i].num;) {
        v[(*iter).id] = a[i].id;
        PE.erase(*iter++);
        t++;
      }
    }
  }
  if (PE.size() == 0) {
    printf("YES\n");
    for (i = 1; i <= n; i++) {
      printf("%d ", v[i]);
    }
  } else {
    printf("NO\n");
  }
  return 0;
}
