#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e6 + 10;
long long N, M;
struct sn {
  long long l, r, id;
  friend bool operator<(sn a, sn b) { return a.l < b.l; }
} E[MAXN];
bool cmp(sn a, sn b) { return a.r < b.r; }
struct sner {
  long long l, r, tim, id;
  friend bool operator<(sner a, sner b) { return a.r < b.r; }
} S[MAXN];
long long ans[MAXN];
set<pair<long long, long long> > st;
int main() {
  scanf("%lld", &N);
  for (long long i = 1; i <= N; i++)
    scanf("%lld%lld", &E[i].l, &E[i].r), E[i].id = i;
  scanf("%lld", &M);
  for (long long i = 1; i <= M; i++)
    scanf("%lld%lld%lld", &S[i].l, &S[i].r, &S[i].tim), S[i].id = i;
  sort(S + 1, S + M + 1);
  sort(E + 1, E + N + 1, cmp);
  long long now = 1;
  for (long long i = 1; i <= M; i++) {
    while (E[now].r <= S[i].r && now <= N) {
      st.insert(make_pair(E[now].l, E[now].id));
      now++;
    }
    while (S[i].tim) {
      set<pair<long long, long long> >::iterator tem =
          st.lower_bound(make_pair(S[i].l, 0));
      if (tem == st.end()) break;
      ans[tem->second] = S[i].id;
      S[i].tim--;
      st.erase(tem);
    }
  }
  for (long long i = 1; i <= N; i++) {
    if (!ans[i]) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  for (long long i = 1; i <= N; i++) printf("%lld ", ans[i]);
  return 0;
}
