#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int ret = 0, c = getchar(), b = 1;
  while (!isdigit(c)) {
    b = c == '-' ? -1 : 1, c = getchar();
  }
  while (isdigit(c)) {
    ret = ret * 10 + c - '0', c = getchar();
  }
  return ret * b;
}
struct node {
  int x, y, k, id;
} a[100005], b[100005];
bool cmp(node x, node y) { return x.y < y.y; }
set<pair<int, int> > s;
int ans[100005];
int main() {
  int n = in();
  for (int i = 1; i <= n; i++) {
    a[i].x = in(), a[i].y = in(), a[i].id = i;
  }
  int m = in();
  for (int i = 1; i <= m; i++) {
    b[i].x = in(), b[i].y = in(), b[i].k = in(), b[i].id = i;
  }
  sort(a + 1, a + n + 1, cmp);
  sort(b + 1, b + m + 1, cmp);
  for (int i = 1, p = 1; i <= m; i++) {
    while (p <= n && a[p].y <= b[i].y)
      s.insert(make_pair(a[p].x, a[p].id)), ++p;
    while (b[i].k) {
      set<pair<int, int> >::iterator it = s.lower_bound(make_pair(b[i].x, 0));
      if (it == s.end()) {
        break;
      }
      ans[it->second] = b[i].id;
      s.erase(it);
      b[i].k--;
    }
  }
  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;
}
