#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 5;
struct Node {
  int l, r, k, id;
  bool operator<(const Node &a) const { return l < a.l; }
} A[N], B[N];
int n, m, cnt = 0, ans[N];
multiset<Node> s;
bool cmp(const Node &a, const Node &b) {
  if (a.r != b.r) return a.r < b.r;
  return a.l < b.l;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &A[i].l, &A[i].r);
    A[i].id = i;
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &B[i].l, &B[i].r, &B[i].k);
    B[i].id = i;
  }
  sort(A + 1, A + n + 1, cmp);
  sort(B + 1, B + m + 1, cmp);
  int cur = 1;
  for (int i = 1; i <= m; i++) {
    while (cur <= n && A[cur].r <= B[i].r) s.insert(A[cur++]);
    multiset<Node>::iterator top, it;
    top = s.lower_bound(B[i]);
    it = s.lower_bound(B[i]);
    int p = 0;
    while (!s.empty() && it != s.end() && p < B[i].k) {
      ans[it->id] = B[i].id;
      it++, p++, cnt++;
    }
    s.erase(top, it);
  }
  if (cnt < n)
    printf("NO\n");
  else {
    printf("YES\n");
    for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  }
  return 0;
}
