#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
struct data {
  int l, r, id, k;
  void inmus(int i) {
    scanf("%d%d", &l, &r);
    id = i;
    k = 0;
  }
  void inat(int i) {
    scanf("%d%d%d", &l, &r, &k);
    id = i;
  }
  friend bool operator<(const data &a, const data &b) {
    return (a.r == b.r) ? a.l < b.l : a.r < b.r;
  }
} a[maxn], b[maxn];
int n, m;
int ans[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) a[i].inmus(i);
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) b[i].inat(i);
  sort(a + 1, a + 1 + n);
  sort(b + 1, b + 1 + m);
  int now = 1;
  set<pair<int, int> > s;
  set<pair<int, int> >::iterator st, en;
  for (int i = 1; i <= m; i++) {
    while (now <= n && a[now].r <= b[i].r) {
      s.insert(pair<int, int>(a[now].l, a[now].id));
      now++;
    }
    st = en = s.lower_bound(pair<int, int>(b[i].l, 0));
    while (b[i].k > 0 && en != s.end()) {
      ans[en->second] = b[i].id;
      b[i].k--;
      en++;
    }
    s.erase(st, en);
  }
  if (now > n && s.empty()) {
    puts("YES");
    for (int i = 1; i <= n; printf("%d ", ans[i++]))
      ;
  } else {
    puts("NO");
  }
  return 0;
}
