#include <bits/stdc++.h>
const int N = 1e5 + 30;
int n, m;
int Ans[N];
struct WLT {
  int l, r, k, id;
} a[N], b[N];
struct NODE {
  int val, id;
  bool operator<(const NODE &rhs) const { return val < rhs.val; }
} tmp;
int cmp(WLT x, WLT y) { return x.r < y.r; }
std::multiset<NODE> 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;
  std::sort(a + 1, a + n + 1, cmp), std::sort(b + 1, b + m + 1, cmp);
  for (int i = 1, j = 1; i <= m; ++i) {
    while (a[j].r <= b[i].r && j <= n) {
      tmp.id = a[j].id, tmp.val = a[j].l;
      s.insert(tmp), ++j;
    }
    while (b[i].k) {
      auto it = s.lower_bound((NODE){b[i].l, 0});
      if (it == s.end()) break;
      Ans[it->id] = b[i].id, --b[i].k;
      s.erase(it);
    }
  }
  for (int i = 1; i <= n; ++i)
    if (!Ans[i]) return printf("NO\n"), 0;
  printf("YES\n");
  for (int i = 1; i <= n; ++i) printf("%d ", Ans[i]);
  printf("\n");
  return 0;
}
