#include <bits/stdc++.h>
using namespace std;
pair<pair<int, int>, int> all[200005];
struct Singer {
  int idx, low, high, t;
} sing[200005];
bool operator<(Singer a, Singer b) {
  if (a.low == b.low) return a.high < b.high;
  return a.low < b.low;
}
multimap<int, pair<int, int> > M;
int ans[200005];
int main() {
  multimap<int, pair<int, int> >::iterator it;
  int i, n, m, h = 1;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d%d", &all[i].first.first, &all[i].first.second);
    all[i].second = i;
  }
  sort(all + 1, all + n + 1);
  scanf("%d", &m);
  for (i = 1; i <= m; ++i) {
    scanf("%d%d%d", &sing[i].low, &sing[i].high, &sing[i].t);
    sing[i].idx = i;
  }
  sort(sing + 1, sing + m + 1);
  for (i = 1; i <= n; ++i) {
    for (; h <= m && sing[h].low <= all[i].first.first; ++h)
      M.insert(make_pair(sing[h].high, make_pair(sing[h].t, sing[h].idx)));
    it = M.lower_bound(all[i].first.second);
    if (it == M.end()) {
      puts("NO");
      return 0;
    }
    ans[all[i].second] = (*it).second.second;
    if ((--((*it).second.first)) <= 0) M.erase(it);
  }
  puts("YES");
  for (i = 1; i <= n; ++i) printf(i == n ? "%d\n" : "%d ", ans[i]);
  return 0;
}
