#include <bits/stdc++.h>
using namespace std;
struct node {
  int l, r, id, k;
  bool operator<(node a) const {
    if (r == a.r) return l < a.l;
    return r < a.r;
  }
} a[100055], b[100005];
int ans[100005];
struct aa {
  int id, val;
  bool operator<(aa a) const {
    if (val == a.val) return id < a.id;
    return val < a.val;
  }
  aa() {}
  aa(int val, int id) : val(val), id(id) {}
};
set<aa> s;
int main() {
  int n, m;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i].l, &a[i].r);
    a[i].id = i;
  }
  cin >> m;
  for (int i = 0; i < m; ++i) {
    scanf("%d%d%d", &b[i].l, &b[i].r, &b[i].k);
    b[i].id = i;
  }
  sort(a, a + n);
  sort(b, b + m);
  int j = 0, cnt = 0;
  for (int i = 0; i < m; i++) {
    while (j < n) {
      if (a[j].r <= b[i].r) {
        s.insert(aa(a[j].l, a[j].id));
        j++;
      } else {
        break;
      }
    }
    for (int k = 0; k < b[i].k; k++) {
      auto it = s.lower_bound(aa(b[i].l, -1));
      if (it == s.end()) break;
      aa tmp = *it;
      ans[tmp.id] = b[i].id + 1;
      cnt++;
      s.erase(tmp);
    }
  }
  if (cnt < n) {
    puts("NO");
  } else {
    puts("YES");
    for (int i = 0; i < n; i++) cout << ans[i] << " ";
  }
  return 0;
}
