#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:20000000")
using namespace std;
int ri() {
  int x;
  scanf("%d", &x);
  return x;
}
long long rll() {
  long long x;
  scanf("%lld", &x);
  return x;
}
int res[100500];
void solve() {
  int n = ri();
  vector<pair<pair<int, int>, int> > mas;
  for (int i = (int)(1); i <= (int)(n); i++) {
    int a = ri(), b = ri();
    mas.push_back(make_pair(make_pair(b, a), i));
  }
  int m = ri();
  vector<pair<pair<int, int>, pair<int, int> > > actor;
  for (int i = (int)(1); i <= (int)(m); i++) {
    int a = ri(), b = ri(), c = ri();
    actor.push_back(make_pair(make_pair(b, a), make_pair(c, i)));
  }
  sort(mas.begin(), mas.end());
  sort(actor.begin(), actor.end());
  map<int, vector<int> > st;
  int j = 0;
  int cnt = 0;
  for (int i = (int)(0); i <= (int)(m - 1); i++) {
    while (j != n && mas[j].first.first <= actor[i].first.first) {
      st[mas[j].first.second].push_back(mas[j].second);
      j++;
    }
    for (int t = 1; t <= actor[i].second.first; t++) {
      map<int, vector<int> >::iterator it =
          st.lower_bound(actor[i].first.second);
      if (it == st.end()) break;
      res[it->second.back()] = actor[i].second.second;
      cnt++;
      it->second.pop_back();
      if (it->second.empty()) st.erase(it);
    }
  }
  if (cnt != n) {
    cout << "NO" << endl;
    return;
  }
  cout << "YES" << endl;
  for (int i = (int)(1); i <= (int)(n); i++) cout << res[i] << " ";
}
int main() {
  solve();
  return 0;
}
