#include <bits/stdc++.h>
using namespace std;
struct Node {
  int l, r, x, id;
} a[1000005];
bool operator<(const Node& t1, const Node& t2) {
  if (t1.l != t2.l) return t1.l < t2.l;
  if (t1.x != t2.x) return t1.x > t2.x;
  if (t1.r != t2.r) return t1.l < t2.r;
  return t1.x > t2.x;
}
struct Node1 {
  Node1(int a, int b, int c) {
    r = a;
    x = b;
    id = c;
  }
  int r, x, id;
};
bool operator<(const Node1& t1, const Node1& t2) {
  if (t1.r != t2.r) return t1.r < t2.r;
  return t1.id < t2.id;
}
set<Node1> iset;
int ans[100005];
int main() {
  int n, m;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].l >> a[i].r;
    a[i].x = -1;
    a[i].id = i;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> a[i + n].l >> a[i + n].r >> a[i + n].x;
    a[n + i].id = i + 1;
  }
  sort(a, a + m + n);
  for (int i = 0; i < m + n; i++) {
    if (a[i].x != -1)
      iset.insert(Node1(a[i].r, a[i].x, a[i].id));
    else {
      set<Node1>::iterator it = iset.lower_bound(Node1(a[i].r, 0, 0));
      if (it != iset.end()) {
        Node1 t = *it;
        iset.erase(it);
        ans[a[i].id] = t.id;
        t.x--;
        if (t.x != 0) iset.insert(t);
      } else {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < n - 1; i++) cout << ans[i] << " ";
  cout << ans[n - 1] << endl;
  return 0;
}
