#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
struct ev {
  mutable int l, r, k, type, idx;
  ev(int l, int r, int idx) : l(l), r(r), idx(idx), type(0) {}
  ev(int l, int r, int k, int idx) : l(l), r(r), k(k), idx(idx), type(1) {}
  bool operator<(const ev& e) const {
    return l != e.l ? l < e.l : type > e.type;
  }
};
struct comp {
  bool operator()(const ev& a, const ev& b) { return a.r < b.r; }
};
int n, m;
vector<ev> e;
multiset<ev, comp> q;
int ans[100000];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    e.push_back(ev(l, r, i));
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    int l, r, k;
    scanf("%d%d%d", &l, &r, &k);
    e.push_back(ev(l, r, k, i));
  }
  sort(e.begin(), e.end());
  bool ae = true;
  for (int i = 0; i < e.size(); i++) {
    ev v = e[i];
    if (v.type == 0) {
      bool f = false;
      while (!q.empty()) {
        auto it = q.lower_bound(v);
        if (it != q.end()) {
          ans[v.idx] = it->idx;
          it->k--;
          if (!it->k) q.erase(it);
          f = true;
          break;
        } else
          break;
      }
      if (!f) {
        ae = false;
        break;
      }
    } else {
      q.insert(v);
    }
  }
  if (ae) {
    printf("YES\n");
    for (int i = 0; i < n; i++) printf("%d ", ans[i] + 1);
  } else
    printf("NO\n");
  return 0;
}
