#include <bits/stdc++.h>
using namespace std;
const int MN = 100001;
int n, m, lo[2 * MN], hi[2 * MN], ans[MN], k[2 * MN], p[2 * MN];
set<pair<int, int> > actors;
set<pair<int, int> >::iterator lb;
bool lexLess(int i, int j) { return (lo[i] == lo[j]) ? i > j : lo[i] < lo[j]; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d %d", lo + i, hi + i), p[i] = i;
  scanf("%d", &m);
  for (int i = n; i < n + m; i++)
    scanf("%d %d %d", lo + i, hi + i, k + i), p[i] = i;
  sort(p, p + n + m, lexLess);
  for (int i = 0; i < n + m; i++) {
    if (p[i] < n) {
      lb = actors.lower_bound(make_pair(hi[p[i]], INT_MIN));
      if (lb == actors.end()) {
        printf("NO\n");
        return 0;
      }
      ans[p[i]] = lb->second - n;
      k[lb->second]--;
      if (k[lb->second] == 0) actors.erase(lb);
    } else
      actors.insert(make_pair(hi[p[i]], p[i]));
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) printf("%d ", ans[i] + 1);
  printf("\n");
}
