#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int n, m;
multimap<int, int> a;
int b[100010];
multimap<int, int> c;
int d[100010];
multimap<int, int> w;
int k[100010];
int ans[100010];
int main() {
  cin >> n;
  int ta, tb;
  for (int i = 0; i < (n); ++i) {
    cin >> ta >> b[i];
    a.insert(make_pair(ta, i));
  }
  cin >> m;
  int tc, td, tk;
  for (int i = 0; i < (m); ++i) {
    cin >> tc >> d[i] >> k[i];
    c.insert(make_pair(tc, i));
  }
  multimap<int, int>::iterator ich = c.begin();
  for (multimap<int, int>::iterator i = a.begin(); i != a.end(); ++i) {
    int l = i->first;
    int r = b[i->second];
    for (; ich != c.end() && ich->first <= l; ++ich) {
      w.insert(make_pair(d[ich->second], ich->second));
    }
    multimap<int, int>::iterator f = w.lower_bound(r);
    if (f == w.end()) {
      cout << "NO" << endl;
      return 0;
    }
    int ch_key = f->second;
    ans[i->second] = ch_key;
    k[ch_key]--;
    if (!k[ch_key]) {
      w.erase(f);
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; ++i) {
    cout << ans[i] + 1 << " ";
  }
  cout << endl;
}
