#include <bits/stdc++.h>
using namespace std;
int n, m;
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cout.precision(10);
  cout << fixed;
  if (argc > 1 && fopen(argv[1], "r")) freopen(argv[1], "rt", stdin);
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < (int)(n); ++i) cin >> a[i] >> b[i];
  cin >> m;
  vector<int> c(m), d(m), k(m);
  for (int i = 0; i < (int)(m); ++i) cin >> c[i] >> d[i] >> k[i];
  vector<pair<int, int> > events;
  for (int i = 0; i < (int)(m); ++i)
    events.push_back(make_pair(c[i] * 2 + 0, i));
  for (int i = 0; i < (int)(n); ++i)
    events.push_back(make_pair(a[i] * 2 + 1, i));
  sort((events).begin(), (events).end());
  multiset<pair<int, int> > st;
  vector<int> res(n, -1);
  for (auto e : events) {
    int i = e.second;
    if (e.first % 2 == 0) {
      st.insert(make_pair(d[i], i));
    } else {
      auto lb = st.lower_bound(make_pair(b[i], 0));
      if (lb == st.end()) {
        cout << "NO" << endl;
        return 0;
      }
      int j = (*lb).second;
      res[i] = j + 1;
      if (--k[j] == 0) st.erase(lb);
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < (int)((int((res).size()))); ++i) cout << res[i] << " ";
  return 0;
}
