#include <bits/stdc++.h>
const long long INF = 2e18;
using namespace std;
struct item {
  long long l, r, type, id;
};
bool comp(item a, item b) {
  if (a.l != b.l) return a.l < b.l;
  if (a.type == b.type) return a.r < b.r;
  return a.type < b.type;
}
int main() {
  long long n, m;
  cin >> n;
  vector<item> v(n);
  vector<long long> ans(n, -1);
  for (long long i = 0; i < n; i++) {
    long long l, r;
    cin >> l >> r;
    v[i].l = l, v[i].r = r;
    v[i].type = 2, v[i].id = i;
  }
  cin >> m;
  v.resize(n + m);
  vector<long long> k(m);
  for (long long i = 0; i < m; i++) {
    long long l, r, kk;
    cin >> l >> r >> kk;
    v[i + n].l = l, v[i + n].r = r;
    k[i] = kk;
    v[i + n].type = 1, v[i + n].id = i;
  }
  sort(v.begin(), v.end(), comp);
  set<pair<long long, long long> > st;
  for (long long i = 0; i < n + m; i++) {
    if (v[i].type == 1)
      st.insert({v[i].r, v[i].id});
    else {
      long long isp = -1;
      auto it = st.lower_bound({v[i].r, 0});
      if (it != st.end()) {
        isp = (*it).second;
        k[isp]--;
        if (k[isp] == 0) st.erase(it);
      }
      if (isp == -1) {
        cout << "NO\n";
        return 0;
      }
      ans[v[i].id] = isp;
    }
  }
  cout << "YES\n";
  for (long long i = 0; i < ans.size(); i++) cout << ans[i] + 1 << ' ';
  return 0;
}
