#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct A {
  int l, r, k, id;
} a[N], b[N];
bool operator<(const A& x, const A& y) { return x.r < y.r; }
int n, m, now = 1, ans[N];
set<pair<int, int> > tr;
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);
  for (int i = 1; i <= m; i++) {
    while (b[i].r >= a[now].r && now <= n) {
      tr.insert(make_pair(a[now].l, now));
      now++;
    }
    while (b[i].k) {
      auto it = tr.lower_bound(make_pair(b[i].l, 0));
      if (it == tr.end()) break;
      ans[a[it->second].id] = b[i].id, b[i].k--;
      tr.erase(it);
    }
  }
  for (int i = 1; i <= n; i++)
    if (!ans[i]) return puts("NO"), 0;
  puts("YES");
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
