#include <bits/stdc++.h>
using namespace std;
int n, a[100010], b[100010], m, c[100010], d[100010], f[100010];
const int inf = 0x3f3f3f3f;
int ans[100010];
int main() {
  scanf("%d", &n);
  vector<pair<int, int> > v, w;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    v.emplace_back(a[i], i);
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &c[i], &d[i], &f[i]);
    w.emplace_back(c[i], i);
  }
  sort(v.begin(), v.end());
  sort(w.begin(), w.end());
  v.emplace_back(inf, 0);
  w.emplace_back(inf, 0);
  int now = 0;
  set<int> parts;
  set<pair<int, int> > actors;
  for (int i = 0, j = 0; i < v.size() && j < w.size();) {
    now = min(v[i].first, w[j].first);
    if (now == inf) break;
    while (w[j].first == now) {
      actors.emplace(d[w[j].second], w[j].second);
      j++;
    }
    while (v[i].first == now) {
      int j = v[i].second;
      if (!actors.empty()) {
        auto it = actors.lower_bound(pair<int, int>(b[j], 0));
        if (it != actors.end()) {
          int k = it->second;
          ans[j] = k;
          f[k]--;
          if (!f[k]) actors.erase(it);
        }
      }
      i++;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (!ans[i]) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
