#include <bits/stdc++.h>
static inline unsigned long long rdtsc() {
  unsigned long long d;
  __asm__ __volatile__("rdtsc" : "=A"(d));
  return d;
}
using namespace std;
const int inf = (int)1e9;
const double eps = 1e-9;
const int maxn = (int)1e5 + 10;
int a[maxn], b[maxn], c[maxn], d[maxn], k[maxn];
pair<pair<int, int>, int> A[maxn];
pair<pair<int, int>, int> B[maxn];
set<pair<int, int> > S;
int res[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; (i) < (n); ++i) scanf("%d%d", &a[i], &b[i]);
  int m;
  scanf("%d", &m);
  for (int i = 0; (i) < (m); ++i) scanf("%d%d%d", &c[i], &d[i], &k[i]);
  for (int i = 0; (i) < (m); ++i) A[i] = make_pair(make_pair(d[i], -c[i]), i);
  sort(A, A + m);
  for (int i = 0; (i) < (n); ++i) B[i] = make_pair(make_pair(b[i], a[i]), i);
  sort(B, B + n);
  int cur = 0;
  for (int i = 0; (i) < (m); ++i) {
    int di = A[i].first.first;
    int ci = -A[i].first.second;
    int ii = A[i].second;
    while (cur < n && B[cur].first.first <= di) {
      S.insert(make_pair(B[cur].first.second, B[cur].second));
      cur += 1;
    }
    for (int _ = 0; (_) < (k[ii]); ++_) {
      set<pair<int, int> >::iterator it = S.lower_bound(make_pair(ci, -1));
      if (it != S.end()) {
        res[it->second] = ii;
        S.erase(it);
      } else
        break;
    }
  }
  if (cur == n && S.empty()) {
    printf("YES\n");
    for (int i = 0; (i) < (n); ++i)
      printf("%d%c", res[i] + 1, " \n"[i + 1 == n]);
  } else {
    printf("NO\n");
  }
  return 0;
}
