#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
struct node {
  int l, r, id, k;
  friend bool operator<(const node &a, const node &b) {
    return (a.r == b.r) ? a.l < b.l : a.r < b.r;
  }
} a[maxn], b[maxn];
int n, m;
int ans[maxn];
set<pair<int, int> > s;
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);
  sort(b + 1, b + m + 1);
  int now = 1;
  for (int i = 1; i <= m; ++i) {
    while (now <= n && a[now].r <= b[i].r) {
      s.insert(make_pair(a[now].l, a[now].id));
      now++;
    }
    int cnt = 0;
    set<pair<int, int> >::iterator it, st;
    st = it = s.lower_bound(make_pair(b[i].l, 0));
    while (cnt < b[i].k && it != s.end()) {
      ans[it->second] = b[i].id;
      it++, cnt++;
    }
    s.erase(st, it);
  }
  if (now > n && s.empty()) {
    printf("YES\n");
    for (int i = 1; i <= n; ++i) {
      if (i > 1) printf(" ");
      printf("%d", ans[i]);
    }
    puts("");
  } else
    printf("NO\n");
  return 0;
}
