#include <bits/stdc++.h>
const int N = 100010;
using namespace std;
struct Node {
  int l, r, id;
  mutable int s;
  bool operator<(const Node& B) const { return l < B.l; }
} A[N], R[N];
struct Comp {
  bool operator()(const Node& u, const Node& v) const { return u.r < v.r; }
};
multiset<Node, Comp> S;
int n, m, Ans[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &A[i].l, &A[i].r), A[i].s = 1, A[i].id = i;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++)
    scanf("%d%d%d", &R[i].l, &R[i].r, &R[i].s), R[i].id = i;
  sort(A + 1, A + n + 1), sort(R + 1, R + m + 1);
  int j = 1;
  for (int i = 1; i <= n; i++) {
    while (j <= m && R[j].l <= A[i].l) S.insert(R[j]), ++j;
    while (A[i].s) {
      multiset<Node, Comp>::iterator p = S.lower_bound(A[i]);
      if (p == S.end()) {
        puts("NO");
        return 0;
      }
      Ans[A[i].id] = p->id;
      if (A[i].s < p->s)
        p->s -= A[i].s, A[i].s = 0;
      else
        A[i].s -= p->s, S.erase(p);
    }
  }
  puts("YES");
  for (int i = 1; i <= n; i++) printf("%d%c", Ans[i], i == n ? '\n' : ' ');
  return 0;
}
