#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
int n, m;
struct play {
  int a, b, nr;
} t[MAX];
struct aktor {
  int a, b, k, nr;
} A[MAX];
bool operator<(aktor a, aktor b) {
  if (a.a != b.a) return a.a < b.a;
  return a.b > b.b;
}
bool operator<(play a, play b) {
  if (a.a != b.a) return a.a < b.a;
  return a.b < b.b;
}
set<pair<int, int> > S;
int wyn[MAX];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &t[i].a, &t[i].b);
    t[i].nr = i;
  }
  sort(t, t + n);
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d%d", &A[i].a, &A[i].b, &A[i].k);
    A[i].nr = i;
  }
  sort(A, A + m);
  int a_nr = 0;
  for (int i = 0; i < n; ++i) {
    while (a_nr < m && A[a_nr].a <= t[i].a) {
      S.insert(make_pair(A[a_nr].b, a_nr));
      a_nr++;
    }
    set<pair<int, int> >::iterator it = S.upper_bound(make_pair(t[i].b, -1));
    if (it == S.end()) {
      printf("NO\n");
      return 0;
    }
    A[it->second].k--;
    wyn[t[i].nr] = it->second;
    if (A[it->second].k == 0) S.erase(it);
  }
  printf("YES\n");
  for (int i = 0; i < n; ++i) printf("%d ", A[wyn[i]].nr + 1);
}
