#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 1000 + 1000;
int n, m;
int a[maxn];
int b[maxn];
int c[maxn];
int d[maxn];
int k[maxn];
int pob[maxn];
int pod[maxn];
int ans[maxn];
set<pair<int, int> > st;
bool cmpb(int x, int y) { return b[x] < b[y]; }
bool cmpd(int x, int y) { return d[x] < d[y]; }
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
    pob[i] = i;
  }
  cin >> m;
  for (int i = 0; i < m; ++i) {
    cin >> c[i] >> d[i] >> k[i];
    pod[i] = i;
  }
  sort(pob, pob + n, cmpb);
  sort(pod, pod + m, cmpd);
  int ind = 0;
  for (int i = 0; i < m; ++i) {
    int v = pod[i];
    while (ind < n && b[pob[ind]] <= d[v]) {
      st.insert(pair<int, int>(a[pob[ind]], pob[ind]));
      ind++;
    }
    while (k[v] > 0 && (int)(st).size() > 0 && c[v] <= (--st.end())->first) {
      k[v]--;
      pair<int, int> u = *st.lower_bound(pair<int, int>(c[v], -10));
      ans[u.second] = v;
      st.erase(u);
    }
  }
  if (ind < n || (int)(st).size() > 0)
    cout << "NO" << endl;
  else {
    cout << "YES" << endl;
    for (int i = 0; i < n; ++i) cout << ans[i] + 1 << " ";
    cout << endl;
  }
  return 0;
}
