#include <bits/stdc++.h>
using namespace std;
struct Node {
  int lo, hi, ty, id;
};
int n, m;
vector<Node> v;
int cnt[111111], ans[111111];
inline bool cmp(Node i, Node j) {
  if (i.lo == j.lo) return i.ty > j.ty;
  return i.lo < j.lo;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  int l, r;
  Node nd;
  nd.ty = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> l >> r;
    nd.lo = l, nd.hi = r, nd.id = i;
    v.push_back(nd);
  }
  cin >> m;
  nd.ty = 1;
  for (int i = 1; i <= m; ++i) {
    cin >> l >> r >> cnt[i];
    nd.lo = l, nd.hi = r, nd.id = i;
    v.push_back(nd);
  }
  sort(v.begin(), v.end(), cmp);
  multiset<pair<int, int> > actors;
  multiset<pair<int, int> >::iterator it;
  for (int i = 0; i < n + m; ++i) {
    if (v[i].ty) {
      actors.insert({v[i].hi, v[i].id});
      continue;
    }
    it = actors.lower_bound({v[i].hi, -1});
    if (it == actors.end()) {
      cout << "NO" << endl;
      return 0;
    }
    ans[v[i].id] = (*it).second;
    --cnt[(*it).second];
    if (cnt[(*it).second] == 0) actors.erase(it);
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; ++i) cout << ans[i] << " ";
  return 0;
}
