#include <bits/stdc++.h>
template <class T>
inline bool rd(T &ret) {
  char c;
  int sgn;
  if (c = getchar(), c == EOF) return 0;
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  sgn = (c == '-') ? -1 : 1;
  ret = (c == '-') ? 0 : (c - '0');
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  ret *= sgn;
  return 1;
}
template <class T>
inline void pt(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) pt(x / 10);
  putchar(x % 10 + '0');
}
using namespace std;
const long long N = 200050;
long long n, m;
struct node {
  long long op, l, r, num, id;
} a[N * 2];
bool cmp(node x, node y) {
  if (x.r != y.r) return x.r < y.r;
  if (x.op != y.op) return x.op < y.op;
}
long long top, b[N];
void input() {
  top = 0;
  for (long long i = 1; i <= n; i++) {
    rd(a[top].l);
    rd(a[top].r);
    a[top].op = 0;
    a[top].id = i;
    top++;
  }
  rd(m);
  for (long long i = 1; i <= m; i++) {
    rd(a[top].l);
    rd(a[top].r);
    rd(a[top].num);
    a[top].op = 1;
    a[top].id = i;
    top++;
  }
  sort(a, a + top, cmp);
}
struct Edge {
  long long id, l;
  bool operator<(const Edge &e) const {
    if (e.l != l) return e.l > l;
    return e.id > id;
  }
  Edge(long long a = 0, long long b = 0) : id(a), l(b) {}
} tmp;
set<Edge> s;
set<Edge>::iterator p;
int main() {
  while (cin >> n) {
    input();
    long long ans = 0;
    s.clear();
    for (long long i = 0; i < top; i++) {
      if (a[i].op) {
        while (s.size() && a[i].num--) {
          p = s.lower_bound(Edge(0, a[i].l));
          if (p == s.end()) break;
          tmp = *p;
          b[tmp.id] = a[i].id;
          s.erase(p);
          ans++;
        }
      } else {
        s.insert(Edge(a[i].id, a[i].l));
      }
    }
    if (ans == n) {
      puts("YES");
      for (long long i = 1; i <= n; i++) {
        pt(b[i]);
        putchar(' ');
      }
    } else
      puts("NO");
  }
  return 0;
}
