#include <bits/stdc++.h>
using namespace std;
const int N = 100003;
struct intv {
  int l, r, k, idx;
  bool isact;
  intv() : isact(false), k(0) {}
  bool operator<(const intv e) const { return r < e.r; }
};
bool comp(const intv& a, const intv& b) {
  if (a.l == b.l) return a.isact;
  return a.l < b.l;
}
int n, m, ans[N];
vector<intv> intervals;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  intervals.resize(n);
  for (int i = 0; i < n; i++)
    cin >> intervals[i].l >> intervals[i].r, intervals[i].idx = i;
  cin >> m;
  intervals.resize(n + m);
  for (int i = n; i < n + m; i++) {
    cin >> intervals[i].l >> intervals[i].r >> intervals[i].k;
    intervals[i].isact = true;
    intervals[i].idx = i - n;
  }
  sort(intervals.begin(), intervals.end(), comp);
  multimap<intv, int> actors;
  bool flag = true;
  for (intv interval : intervals) {
    if (interval.isact) {
      actors.insert(make_pair(interval, interval.k));
    } else {
      auto it = actors.lower_bound(interval);
      if (it == actors.end()) {
        flag = false;
        break;
      } else {
        ans[interval.idx] = it->first.idx;
        if (it->second == 1)
          actors.erase(it);
        else
          it->second = it->second - 1;
      }
    }
  }
  if (flag) {
    cout << "YES\n";
    for (int i = 0; i < n; i++) cout << ans[i] + 1 << " ";
    cout << "\n";
  } else
    cout << "NO\n";
  return 0;
}
