#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > ss;
struct Node {
  int l, r, ope;
  bool operator<(const Node &b) const {
    if (l != b.l) return l < b.l;
    return ope > b.ope;
  }
};
Node a[200010];
int num[100010], ans[100010];
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i].l, &a[i].r);
    a[i].ope = -1 - i;
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &a[i + n].l, &a[i + n].r, &num[i]);
    a[i + n].ope = i;
  }
  sort(a, a + n + m);
  for (int i = 0; i < n + m; i++) {
    if (a[i].ope >= 0) {
      ss.insert(make_pair(a[i].r, a[i].ope));
    } else {
      if (ss.size() == 0) {
        puts("NO");
        return 0;
      }
      set<pair<int, int> >::iterator pos =
          ss.lower_bound(make_pair(a[i].r, -1));
      if (pos == ss.end()) {
        puts("NO");
        return 0;
      }
      pair<int, int> x = *pos;
      num[x.second]--;
      ans[-(a[i].ope + 1)] = x.second + 1;
      if (num[x.second] == 0) {
        ss.erase(pos);
      }
    }
  }
  puts("YES");
  for (int i = 0; i < n; i++) {
    printf("%d ", ans[i]);
  }
  puts("");
  return 0;
}
