#include <bits/stdc++.h>
using namespace std;
long long mul(long long a, long long b) { return (a * b) % (100000007); }
long long add(long long a, long long b) { return (a + b) % (100000007); }
long long sub(long long a, long long b) {
  return (a - b + (a - b) / (100000007) * (100000007) + (100000007)) %
         (100000007);
}
int n, m;
struct Pair {
 public:
  int l, r, i;
  bool flag;
  friend bool operator<(const Pair a, const Pair b) { return a.r < b.r; }
} a[(100000 + 10) * 2];
int k[(100000 + 10)];
int cmp(const void *a, const void *b) {
  Pair a2 = *(Pair *)a;
  Pair b2 = *(Pair *)b;
  if (a2.l ^ b2.l) return a2.l < b2.l ? -1 : 1;
  return a2.flag < b2.flag ? -1 : a2.flag == b2.flag ? 0 : 1;
}
multiset<Pair> S;
multiset<Pair>::iterator it;
int ans[(100000 + 10)];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &a[i].l, &a[i].r), a[i].i = i, a[i].flag = 1;
  scanf("%d", &m);
  for (int i = n + 1; i <= n + m; i++)
    scanf("%d%d%d", &a[i].l, &a[i].r, &k[i - n]), a[i].i = i - n, a[i].flag = 0;
  qsort(a + 1, n + m, sizeof(a[1]), cmp);
  S.clear();
  for (int i = 1; i <= n + m; i++) {
    if (!a[i].flag)
      S.insert(a[i]);
    else {
      it = S.lower_bound(a[i]);
      if (it != S.end()) {
        ans[a[i].i] = it->i;
        if (--k[it->i] == 0) S.erase(it);
      } else {
        cout << "NO\n";
        return 0;
      }
    }
  }
  cout << "YES\n";
  printf("%d", ans[1]);
  for (int i = 2; i <= n; i++) printf(" %d", ans[i]);
  printf("\n");
  return 0;
}
