#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[1 << 14], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 14, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline long long read() {
  long long x = 0, f = 1;
  char c = gc();
  for (; !isdigit(c); c = gc()) {
    if (c == '-') f = -1;
    if (c == EOF) return EOF;
  }
  for (; isdigit(c); c = gc()) x = (x << 1) + (x << 3) + (c ^ 48);
  return x * f;
}
inline void wr(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) wr(x / 10);
  putchar(x % 10 | 48);
}
const long long N = 2e5 + 10, INF = 0x3f3f3f3f;
long long cnt, n, m, ans[N];
struct sxd {
  long long l, r, k, id;
} a[N];
struct syy {
  long long x, id;
  syy(long long X = 0, long long I = 0) : x(X), id(I) {}
};
bool operator<(syy a, syy b) { return a.x == b.x ? a.id < b.id : a.x < b.x; }
bool ak(sxd A, sxd B) { return A.r == B.r ? A.k < B.k : A.r < B.r; }
set<syy> S;
int main() {
  n = read();
  for (long long i = 1; i <= n; ++i)
    a[++cnt].l = read(), a[cnt].r = read(), a[cnt].k = 0, a[cnt].id = i;
  m = read();
  for (long long i = 1; i <= m; ++i)
    a[++cnt].l = read(), a[cnt].r = read(), a[cnt].k = read(), a[cnt].id = i;
  sort(a + 1, a + 1 + cnt, ak);
  S.insert(syy(-INF, 0));
  S.insert(syy(INF, 0));
  for (long long i = 1; i <= cnt; ++i)
    if (!a[i].k)
      S.insert(syy(a[i].l, a[i].id));
    else {
      set<syy>::iterator it = S.lower_bound((syy){a[i].l, 0});
      while ((*it).id && a[i].k) {
        ans[(*it).id] = a[i].id;
        a[i].k--;
        S.erase(it);
        it = S.lower_bound((syy){a[i].l, 0});
      }
    }
  if (S.size() > 2) return puts("NO"), 0;
  puts("YES");
  for (long long i = 1; i <= n; ++i, putchar(' ')) wr(ans[i]);
  return 0;
}
