#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
struct play {
  int u, v, k, id;
  bool operator<(const play &b) const {
    return v < b.v || (v == b.v && u < b.u);
  }
};
play p[100020], q[100020];
set<pair<int, int> > s;
set<pair<int, int> >::iterator it, itt;
int ans[100020];
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d%d", &p[i].u, &p[i].v), p[i].k = i + 1;
  sort(p, p + n);
  scanf("%d", &m);
  for (int i = 0; i < m; ++i)
    scanf("%d%d%d", &q[i].u, &q[i].v, &q[i].k), q[i].id = i + 1;
  sort(q, q + m);
  int j = 0;
  for (int i = 0; i < m; ++i) {
    int k = q[i].k;
    while (p[j].v <= q[i].v && j < n) {
      s.insert(make_pair(p[j].u, p[j].k));
      j++;
    }
    it = s.lower_bound(make_pair(q[i].u, -1));
    itt = it;
    for (; it != s.end() && k > 0; ++it, k--) ans[(*it).second] = q[i].id;
    s.erase(itt, it);
  }
  if (j == n && s.size() == 0) {
    puts("YES");
    for (int i = 1; i <= n; ++i) printf("%d%c", ans[i], i == n ? '\n' : ' ');
  } else
    puts("NO");
  return 0;
}
