#include <bits/stdc++.h>
using namespace std;
int a[100002], b[100002], c[100002], d[100002], k[100002], ans[100002];
pair<int, int> e[200002];
int main() {
  set<pair<int, int> > s;
  set<pair<int, int> >::iterator it;
  int n, i, j, co = 0, m;
  scanf("%d", &n);
  ;
  for (i = 0; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    ;
    e[co++] = make_pair(2 * a[i] + 1, i);
  }
  scanf("%d", &m);
  ;
  for (i = 0; i < m; i++) {
    scanf("%d%d", &c[i], &d[i]);
    ;
    scanf("%d", &k[i]);
    ;
    e[co++] = make_pair(2 * c[i], i);
  }
  sort(e, e + co);
  for (i = 0; i < co; i++) {
    if (e[i].first % 2 == 0)
      s.insert(make_pair(d[e[i].second], e[i].second));
    else {
      int upper = b[e[i].second];
      it = s.lower_bound(make_pair(upper, 0));
      if (it == s.end()) {
        cout << "NO\n";
        return 0;
      } else {
        int ac = it->second;
        ans[e[i].second] = ac + 1;
        k[ac]--;
        if (k[ac] == 0) s.erase(it);
      }
    }
  }
  cout << "YES\n";
  for (i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
