#include <bits/stdc++.h>
using namespace std;
int n, m, ans[100007];
vector<pair<pair<int, int>, int> > play;
vector<pair<pair<int, int>, pair<int, int> > > actor;
multiset<pair<int, pair<int, int> > > mm;
multiset<pair<int, pair<int, int> > >::iterator it;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    play.push_back(make_pair(pair<int, int>(x, y), i));
  }
  sort(play.begin(), play.end());
  cin >> m;
  for (int i = 1; i <= m; i++) {
    int x, y, k;
    cin >> x >> y >> k;
    actor.push_back(make_pair(pair<int, int>(x, y), pair<int, int>(k, i)));
  }
  sort(actor.begin(), actor.end());
  int j = 0;
  for (int i = 0; i < n; i++) {
    while (j < m && play[i].first.first >= actor[j].first.first) {
      mm.insert(make_pair(actor[j].first.second, actor[j].second));
      j++;
    }
    it = mm.lower_bound(make_pair(play[i].first.second, pair<int, int>(0, 0)));
    if (it == mm.end()) {
      cout << "NO" << endl;
      return 0;
    }
    ans[play[i].second] = it->second.second;
    if (it->second.first > 1) {
      mm.insert(make_pair(it->first, pair<int, int>((it->second.first) - 1,
                                                    it->second.second)));
    }
    mm.erase(it);
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
