#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
const int INF = 0x3f3f3f3f;
struct actor {
  int a, b, k, id;
  bool operator<(const actor &p) const {
    if (!k) return 0;
    if (!p.k) return 1;
    return b < p.b;
  }
} a[maxn], p[maxn];
bool cmp(actor x, actor y) { return x.a < y.a || x.a == y.a && x.b < y.b; }
int n, m, ans[maxn];
int run() {
  sort(p, p + n, cmp);
  sort(a, a + m, cmp);
  multiset<actor> s;
  int j = 0;
  for (int i = 0; i < n; i++) {
    while (j < m && a[j].a <= p[i].a) s.insert(a[j++]);
    multiset<actor>::iterator x = s.begin();
    multiset<actor>::iterator it = s.lower_bound(p[i]);
    if (it == s.end() || it->k == 0) return 0;
    ans[p[i].id] = it->id;
    actor t = *it;
    t.k--;
    s.erase(it);
    s.insert(t);
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i].a >> p[i].b;
    p[i].id = i;
    p[i].k = -1;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> a[i].a >> a[i].b >> a[i].k;
    a[i].id = i;
  }
  if (!run())
    puts("NO");
  else {
    cout << "YES\n" << ans[0] + 1;
    for (int i = 1; i < n; i++) cout << " " << ans[i] + 1;
    cout << endl;
  }
  return 0;
}
