#include <bits/stdc++.h>
using namespace std;
long long n, a[400005], b[400005], c[400005], d[400005], k[400005];
vector<long long> v;
map<long long, long long> mpp;
set<pair<long long, pair<long long, long long> > > st;
set<pair<long long, pair<long long, long long> > >::iterator it;
long long m, ans[400005];
vector<pair<long long, long long> > si[400005];
vector<pair<long long, pair<long long, long long> > > be[400005];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    v.push_back(a[i]);
    v.push_back(b[i]);
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> c[i] >> d[i] >> k[i];
    v.push_back(c[i]);
    v.push_back(d[i]);
  }
  sort(v.begin(), v.end());
  long long pp = 0;
  for (int i = 0; i < v.size(); i++) {
    if (!i || v[i] != v[i - 1]) pp++;
    mpp[v[i]] = pp;
  }
  for (int i = 1; i <= n; i++) {
    a[i] = mpp[a[i]];
    b[i] = mpp[b[i]];
    si[a[i]].push_back(make_pair(b[i], (long long)i));
  }
  for (int i = 1; i <= m; i++) {
    c[i] = mpp[c[i]];
    d[i] = mpp[d[i]];
    be[c[i]].push_back(make_pair(d[i], make_pair(k[i], (long long)i)));
  }
  for (int x = 1; x <= 2 * (n + m); x++) {
    for (int i = 0; i < be[x].size(); i++) {
      st.insert(be[x][i]);
    }
    for (int i = 0; i < si[x].size(); i++) {
      it = st.lower_bound(make_pair(si[x][i].first, make_pair(0LL, 0LL)));
      if (it == st.end()) {
        cout << "NO";
        return 0;
      }
      ans[si[x][i].second] = (*it).second.second;
      pair<long long, pair<long long, long long> > p = (*it);
      st.erase(it);
      p.second.first--;
      if (p.second.first) st.insert(p);
    }
  }
  cout << "YES\n";
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
