#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m;
struct Part {
  int l, r, id;
  bool operator<(const Part &a) const { return l < a.l; }
} p[N];
struct Act {
  int l, r, k, id;
  bool operator<(const Act &a) const { return l < a.l; }
} a[N];
multimap<int, int> ma;
int ans[N];
int main(void) {
  int i, j;
  while (~scanf("%d", &n)) {
    for (i = 1; i <= n; i++) {
      scanf("%d%d", &p[i].l, &p[i].r);
      p[i].id = i;
    }
    sort(p + 1, p + n + 1);
    scanf("%d", &m);
    for (i = 1; i <= m; i++) {
      scanf("%d%d%d", &a[i].l, &a[i].r, &a[i].k);
      a[i].id = i;
    }
    sort(a + 1, a + m + 1);
    ma.clear();
    for (i = 1, j = 1; i <= n; i++) {
      while (j <= m && a[j].l <= p[i].l) ma.insert(make_pair(a[j].r, j)), j++;
      multimap<int, int>::iterator it = ma.lower_bound(p[i].r);
      if (it == ma.end()) break;
      int id = it->second;
      ma.erase(it);
      ans[p[i].id] = a[id].id;
      if (--a[id].k > 0) ma.insert(make_pair(a[id].r, id));
    }
    if (i <= n)
      puts("NO");
    else {
      puts("YES");
      for (i = 1; i < n; i++) printf("%d ", ans[i]);
      printf("%d\n", ans[n]);
    }
  }
  return 0;
}
