#include <bits/stdc++.h>
using namespace std;
int i, j, n, m, a, b, c, d, op, maxi, mini, mij, ls, ld, ul, timp, k, l, r, ok;
vector<pair<pair<int, int>, int> > v;
int sol[1000005];
set<pair<int, int> > myset;
set<pair<int, int> >::iterator it;
int nr[1000005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a >> b;
    v.push_back(make_pair(make_pair(a, b), i));
  }
  cin >> m;
  for (i = 1; i <= m; i++) {
    cin >> a >> b >> nr[i];
    v.push_back(make_pair(make_pair(a, -b), -i));
  }
  sort(v.begin(), v.end());
  for (i = 0; i < v.size(); i++) {
    if (v[i].second < 0) {
      myset.insert(make_pair(-v[i].first.second, -v[i].second));
    } else {
      it = myset.lower_bound(make_pair(v[i].first.second, 0));
      if (it == myset.end()) {
        cout << "NO";
        return 0;
      } else {
        sol[v[i].second] = (*it).second;
        nr[(*it).second]--;
        if (nr[(*it).second] == 0) myset.erase(it);
      }
    }
  }
  cout << "YES\n";
  for (i = 1; i <= n; i++) cout << sol[i] << " ";
  return 0;
}
