#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
int n, m;
struct Part {
  int l, r, id;
} part[maxn];
struct Actor {
  int l, r, k, id;
} actor[maxn];
bool cmp1(Part A, Part B) {
  if (A.l != B.l) return A.l < B.l;
  return A.r < B.r;
}
bool cmp2(Actor A, Actor B) {
  if (A.l != B.l) return A.l < B.l;
  return A.r < B.r;
}
set<pair<int, int> > SP;
int ans[maxn];
int num[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    part[i].l = a;
    part[i].r = b;
    part[i].id = i;
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    actor[i].l = a;
    actor[i].r = b;
    actor[i].k = c;
    actor[i].id = i;
    num[i] = c;
  }
  sort(part, part + n, cmp1);
  sort(actor, actor + m, cmp2);
  bool flag = true;
  int nx = 0;
  SP.insert(make_pair(1756942789, 0));
  for (int i = 0; i < n; i++) {
    while (nx < m && actor[nx].l <= part[i].l) {
      SP.insert(make_pair(actor[nx].r, actor[nx].id));
      nx++;
    }
    pair<int, int> temp = *(SP.lower_bound(make_pair(part[i].r, 0)));
    if (temp.first == 1756942789) {
      flag = false;
      break;
    }
    ans[part[i].id] = temp.second;
    num[temp.second]--;
    if (num[temp.second] == 0) SP.erase(temp);
  }
  if (flag == false)
    puts("NO");
  else {
    puts("YES");
    for (int i = 0; i < n; i++) printf("%d ", ans[i] + 1);
    putchar(10);
  }
  return 0;
}
