#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m, ans[N];
struct node {
  int a, b, tp, k, id;
} p[N << 1];
bool cmp(node x, node y) { return x.a < y.a || (x.a == y.a && x.tp > y.tp); }
struct str {
  int ed, k, id;
  bool operator<(const str &tp) const { return ed < tp.ed; }
};
multiset<str> S;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &p[i].a, &p[i].b);
    p[i].tp = 1, p[i].k = 0, p[i].id = i;
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d%d", &p[i + n].a, &p[i + n].b, &p[i + n].k);
    p[i + n].tp = 2, p[i + n].id = i;
  }
  sort(p + 1, p + n + m + 1, cmp);
  for (int i = 1; i <= n + m; ++i) {
    if (p[i].tp == 2) {
      S.insert((str){p[i].b, p[i].k, p[i].id});
      continue;
    }
    multiset<str>::iterator it = S.lower_bound((str){p[i].b, 0, 0});
    if (it == S.end()) {
      puts("NO");
      return 0;
    }
    ans[p[i].id] = (*it).id;
    if ((*it).k > 1) S.insert((str){(*it).ed, (*it).k - 1, (*it).id});
    S.erase(it);
  }
  puts("YES");
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  return 0;
}
