#include <bits/stdc++.h>
using namespace std;
long long n, m, cnt, ans[100005];
struct node {
  long long l, r, k, id;
} a[200005];
struct zd {
  long long x, id;
};
bool operator<(zd a, zd b) { return a.x == b.x ? a.id < b.id : a.x < b.x; }
set<zd> s;
bool cmp(node aa, node bb) { return aa.r == bb.r ? aa.k < bb.k : aa.r < bb.r; }
int main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; ++i) {
    ++cnt;
    scanf("%lld%lld", &a[cnt].l, &a[cnt].r);
    a[cnt].id = i;
  }
  scanf("%lld", &m);
  for (long long i = 1; i <= m; ++i) {
    cnt++;
    scanf("%lld%lld%lld", &a[cnt].l, &a[cnt].r, &a[cnt].k);
    a[cnt].id = i;
  }
  sort(a + 1, a + cnt + 1, cmp);
  long long zs = 0;
  for (long long i = 1; i <= cnt; ++i)
    if (!a[i].k)
      s.insert((zd){a[i].l, a[i].id});
    else {
      set<zd>::iterator it = s.lower_bound((zd){a[i].l, 0});
      long long rr = a[i].k;
      while (it != s.end() && rr) {
        ans[(*it).id] = a[i].id;
        rr--;
        zs++;
        s.erase(it);
        it = s.lower_bound((zd){a[i].l, 0});
      }
    }
  if (zs != n) {
    puts("NO");
    return 0;
  } else
    puts("YES");
  for (long long i = 1; i <= n; ++i) printf("%lld ", ans[i]);
  return 0;
}
