#include <bits/stdc++.h>
using namespace std;
struct actor {
  int c, d, k, num;
};
bool comp1(actor a, actor b) { return a.d < b.d || (a.d == b.d && a.c > b.c); }
bool comp2(pair<int, pair<int, int> > a, pair<int, pair<int, int> > b) {
  return a.second.first < b.second.first;
}
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<pair<int, pair<int, int> > > a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i].first >> a[i].second.first, a[i].second.second = i;
  int m;
  cin >> m;
  vector<actor> b(m);
  for (int i = 0; i < m; i++) cin >> b[i].c >> b[i].d >> b[i].k, b[i].num = i;
  sort(a.begin(), a.end(), comp2);
  sort(b.begin(), b.end(), comp1);
  set<pair<int, pair<int, int> > > s;
  int ptr = 0;
  vector<int> res(n, -1);
  for (int i = 0; i < m; i++) {
    while (ptr < n && a[ptr].second.first <= b[i].d) {
      s.insert(a[ptr]);
      ptr++;
    }
    while (true) {
      auto it = s.lower_bound(make_pair(b[i].c, make_pair(-1, -1)));
      if (it == s.end() || b[i].k == 0)
        break;
      else {
        res[it->second.second] = b[i].num;
        b[i].k--;
        s.erase(it);
      }
    }
  }
  for (int i = 0; i < n; i++)
    if (res[i] == -1) {
      cout << "NO\n";
      return 0;
    }
  cout << "YES\n";
  for (int i = 0; i < n; i++) cout << res[i] + 1 << ' ';
  cout << '\n';
  return 0;
}
