#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
const int MAXM = 100000;
struct part {
  int l, r, id;
  part() {}
  part(int l, int r, int id) : l(l), r(r), id(id) {}
};
struct actor {
  int l, r, id;
  actor() {}
  actor(int l, int r, int id) : l(l), r(r), id(id) {}
};
int n, m;
int ans[MAXN];
part P[MAXN];
int cnt[MAXM];
actor A[MAXM];
bool cmp_part(const part &x, const part &y) {
  if (x.l != y.l) return x.l < y.l;
  if (x.r != y.r) return x.r < y.r;
  return x.id < y.id;
}
bool cmp_actor_1(const actor &x, const actor &y) {
  if (x.l != y.l) return x.l < y.l;
  if (x.r != y.r) return x.r < y.r;
  return x.id < y.id;
}
struct cmp_actor_2 {
  bool operator()(const actor &a, const actor &b) {
    if (a.r != b.r) return a.r < b.r;
    return a.id < b.id;
  }
};
set<actor, cmp_actor_2> s;
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int c, d;
    scanf("%d%d", &c, &d);
    P[i] = part(c, d, i);
  }
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    int a, b, k;
    scanf("%d%d%d", &a, &b, &k);
    A[i] = actor(a, b, i);
    cnt[i] = k;
  }
  sort(P, P + n, cmp_part);
  sort(A, A + m, cmp_actor_1);
  int j = 0;
  for (int i = 0; i < n; ++i) {
    while (j < m && A[j].l <= P[i].l) s.insert(A[j++]);
    auto it = s.lower_bound(actor(0, P[i].r, -1));
    if (it == s.end()) {
      printf("NO\n");
      return 0;
    }
    ans[P[i].id] = it->id;
    --cnt[it->id];
    if (cnt[it->id] == 0) s.erase(it);
  }
  printf("YES\n");
  for (int i = 0; i < n; ++i) printf("%d ", ans[i] + 1);
  printf("\n");
  return 0;
}
