#include <bits/stdc++.h>
using namespace std;
struct bg {
  int l, r, k, vt;
  bool operator<(bg b) const { return r < b.r; }
};
const int nm = 200002;
int n, m;
bg a[nm];
set<pair<int, int> > x;
int kq[nm];
bool cmp(bg a, bg b) {
  if (a.l != b.l) return a.l < b.l;
  return a.k > b.k;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].l >> a[i].r;
    a[i].k = 0;
    a[i].vt = i;
  }
  cin >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> a[i + n].l >> a[i + n].r >> a[i + n].k;
    a[i + n].vt = i + n;
  }
  sort(a + 1, a + m + n + 1, cmp);
  for (int i = 1; i <= m + n; ++i) {
    if (a[i].k == 0) {
      set<pair<int, int> >::iterator it = x.lower_bound(make_pair(a[i].r, 0));
      if (it == x.end()) {
        cout << "NO\n";
        return 0;
      }
      int j = (*it).second;
      kq[a[i].vt] = a[j].vt - n;
      a[j].k--;
      if (a[j].k == 0) x.erase(it);
    } else {
      x.insert(make_pair(a[i].r, i));
    }
  }
  cout << "YES\n";
  for (int i = 1; i <= n; ++i) cout << kq[i] << " ";
}
