#include <bits/stdc++.h>
using namespace std;
struct Ev {
  int a, ind;
  bool act, fn;
  Ev(int a, int ind, bool act, bool fn) : a(a), ind(ind), act(act), fn(fn) {}
  Ev() {}
};
int n, m;
int a[100000], b[100000], c[100000], d[100001], k[100000];
Ev e[300000];
int ec = 0;
bool cmp(const Ev &lhs, const Ev &rhs) {
  if (lhs.a == rhs.a) {
    return lhs.act && !rhs.act;
  }
  return lhs.a < rhs.a;
}
struct Cmp {
  bool operator()(const int &lhs, const int &rhs) const {
    if (d[lhs] == d[rhs]) return lhs > rhs;
    return d[lhs] < d[rhs];
  }
};
set<int, Cmp> se;
int ans[100000];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < (int)(n); ++i) cin >> a[i] >> b[i];
  cin >> m;
  for (int i = 0; i < (int)(m); ++i) cin >> c[i] >> d[i] >> k[i];
  for (int i = 0; i < (int)(n); ++i) e[ec++] = Ev(a[i], i, false, false);
  for (int i = 0; i < (int)(m); ++i) e[ec++] = Ev(c[i], i, true, false);
  for (int i = 0; i < (int)(m); ++i) e[ec++] = Ev(d[i] + 1, i, true, true);
  sort(e, e + ec, cmp);
  for (int i = 0; i < (int)(ec); ++i) {
    if (e[i].act) {
      if (e[i].fn) {
        se.erase(e[i].ind);
      } else {
        se.insert(e[i].ind);
      }
    } else {
      d[m] = b[e[i].ind];
      auto it = se.lower_bound(m);
      if (it == se.end()) {
        cout << "NO\n";
        return 0;
      }
      int ind = *it;
      ans[e[i].ind] = ind + 1;
      if (--k[ind] == 0) {
        se.erase(ind);
      }
    }
  }
  cout << "YES\n";
  for (int i = 0; i < (int)(n); ++i) cout << ans[i] << ' ';
  cout << endl;
  return 0;
}
