#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ret = 0, f = 1;
  char ch;
  for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') f = -f;
  for (; '0' <= ch && ch <= '9'; ch = getchar()) ret = ret * 10 + ch - 48;
  return ret * f;
}
const int N = 100010, inf = (int)2e9;
struct E {
  int a, b, k, pos;
  int operator<(const E &x) const { return a < x.a; }
} B[N << 1], *A = B + N;
struct cmp {
  int operator()(int a, int b) {
    return B[a].b < B[b].b || (B[a].b == B[b].b && a > b);
  }
};
set<int, cmp> S;
int n, m;
int init() {
  n = read();
  for (int i = 1; i <= n; i++) {
    A[i].a = read();
    A[i].b = read();
    A[i].pos = i;
  }
  B[0].b = inf;
  sort(A + 1, A + n + 1);
  m = read();
  for (int i = 1; i <= m; i++) {
    B[i].a = read();
    B[i].b = read();
    B[i].k = read();
    B[i].pos = i;
  }
  sort(B + 1, B + m + 1);
  return 0;
}
int ans[N];
int work() {
  int j = 1, i = 1, x;
  S.insert(0);
  for (i = 1; i <= n; i++) {
    for (; j <= m && B[j].a <= A[i].a; j++) S.insert(j);
    set<int, cmp>::iterator it = S.lower_bound(i + N), j;
    if (*it == 0) {
      printf("NO\n");
      return 0;
    } else {
      x = *it;
      ans[A[i].pos] = B[x].pos;
      B[x].k--;
      if (B[x].k == 0) S.erase(it);
    }
  }
  printf("YES\n");
  for (int i = 1; i <= n; i++) {
    printf("%d%c", ans[i], i == n ? '\n' : ' ');
  }
  return 0;
}
int main() {
  init();
  work();
  return 0;
}
