#include <bits/stdc++.h>
using namespace std;
int res[112345], a[112345], b[112345], c[112345], d[112345], k[112345];
int n, m;
struct Event {
  int t;
  int index;
  int time;
  Event(int t, int index, int time) : t(t), index(index), time(time){};
};
vector<Event> event;
bool cmp(Event a, Event b) {
  if (a.time != b.time) return a.time < b.time;
  if (a.t != b.t) return a.t < b.t;
  return a.index < b.index;
}
set<pair<int, int> > actor;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
  cin >> m;
  for (int i = 1; i <= m; i++) cin >> c[i] >> d[i] >> k[i];
  for (int i = 1; i <= m; i++) {
    event.push_back(Event(-1, i, c[i]));
    event.push_back(Event(1, i, d[i]));
  }
  for (int i = 1; i <= n; i++) event.push_back(Event(0, i, a[i]));
  sort(event.begin(), event.end(), cmp);
  for (int i = 0; i < (int)event.size(); i++)
    if (event[i].t == -1)
      actor.insert(make_pair(d[event[i].index], event[i].index));
    else if (event[i].t == 1) {
      set<pair<int, int> >::iterator it =
          actor.find(make_pair(d[event[i].index], event[i].index));
      if (it != actor.end()) actor.erase(it);
    } else {
      int part = event[i].index;
      while (true) {
        set<pair<int, int> >::iterator it =
            actor.lower_bound(make_pair(b[part], -1));
        if (it == actor.end()) break;
        k[it->second]--;
        res[part] = it->second;
        if (k[it->second] == 0) actor.erase(it);
        break;
      }
    }
  bool ok = true;
  for (int i = 1; i <= n; i++)
    if (res[i] == 0) ok = false;
  if (ok) {
    cout << "YES" << endl;
    for (int i = 1; i <= n; i++) cout << res[i] << " ";
    cout << endl;
  } else
    cout << "NO" << endl;
  return 0;
}
