#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, m, Ans[maxn];
struct R {
  int l, r, k, id;
} a[maxn], b[maxn];
struct node {
  int val, id;
  friend bool operator<(node x, node y) { return x.val < y.val; }
} tmp;
multiset<node> s;
bool cmp(R x, R y) { return x.r < y.r; }
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 + 1 + n, cmp);
  sort(b + 1, b + 1 + m, cmp);
  int j = 1;
  for (int i = 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;
}
