#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
struct Node {
  int l, u, t, s;
} p[MAXN];
int ptr[MAXN], n, m;
bool cmp(int a, int b) {
  if (p[a].u == p[b].u) return p[a].t < p[b].t;
  return p[a].u < p[b].u;
}
struct wcmp {
  bool operator()(int a, int b) { return p[a].l < p[b].l; }
};
multiset<int, wcmp> w;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &p[i].l, &p[i].u);
    p[i].t = 0;
  }
  scanf("%d", &m);
  for (int i = n; i < n + m; i++) {
    scanf("%d%d%d", &p[i].l, &p[i].u, &p[i].t);
  }
  for (int i = 0; i < MAXN; i++) ptr[i] = i;
  sort(ptr, ptr + n + m, cmp);
  multiset<int, wcmp>::iterator it;
  for (int i = 0, cur = ptr[i]; i < n + m; i++, cur = ptr[i]) {
    if (p[cur].t == 0)
      w.insert(cur);
    else {
      it = w.lower_bound(cur);
      while (it != w.end() && p[cur].t) {
        p[*it].s = cur - n + 1;
        p[cur].t--;
        w.erase(it++);
      }
    }
  }
  if (!w.size()) {
    printf("YES\n");
    for (int i = 0; i < n; i++) {
      printf(i ? " %d" : "%d", p[i].s);
    }
    printf("\n");
  } else
    printf("NO\n");
  return 0;
}
