#include <bits/stdc++.h>
using namespace std;
struct xy {
  int l, r, k, id;
  friend bool operator<(xy a, xy b) { return a.r < b.r; }
} a[100005], b[100005];
set<pair<int, int> > s;
int ans[100005];
int main() {
  int i, n, m, p = 1;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i].l >> a[i].r;
    a[i].id = i;
  }
  cin >> m;
  for (i = 1; i <= m; i++) {
    cin >> b[i].l >> b[i].r >> b[i].k;
    b[i].id = i;
  }
  sort(a + 1, a + n + 1);
  sort(b + 1, b + m + 1);
  for (i = 1; i <= m; i++) {
    while (p <= n && a[p].r <= b[i].r) {
      s.insert(make_pair(a[p].l, a[p].id));
      p++;
    }
    while (b[i].k) {
      set<pair<int, int> >::iterator it = s.lower_bound(make_pair(b[i].l, 0));
      if (it == s.end()) break;
      ans[it->second] = b[i].id;
      b[i].k--;
      s.erase(it);
    }
  }
  for (i = 1; i <= n; i++) {
    if (!ans[i]) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  for (i = 1; i < n; i++) {
    cout << ans[i] << " ";
  }
  cout << ans[n] << endl;
  return 0;
}
