#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m;
int num[100005], ans[100005];
struct data {
  int l, r, K, id;
} a[100005], b[100005];
bool operator<(data a, data b) { return a.r < b.r; }
set<pair<int, int> > q;
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i].l = read(), a[i].r = read(), a[i].id = i;
  sort(a + 1, a + n + 1);
  m = read();
  for (int i = 1; i <= m; i++)
    b[i].l = read(), b[i].r = read(), b[i].K = read(), b[i].id = i;
  sort(b + 1, b + m + 1);
  int now = 1;
  for (int i = 1; i <= m; i++) {
    while (b[i].r >= a[now].r && now <= n) {
      q.insert(make_pair(a[now].l, now));
      now++;
    }
    while (b[i].K--) {
      set<pair<int, int> >::iterator p = q.lower_bound(make_pair(b[i].l, 0));
      if (p == q.end()) break;
      ans[a[p->second].id] = b[i].id;
      q.erase(p);
    }
  }
  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;
}
