#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<pair<pair<long long, long long>, long long> > parts;
vector<pair<pair<long long, long long>, long long> > actors;
long long ans[200005];
long long k[200005];
set<pair<long long, long long> > s;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  memset(ans, -1, sizeof(ans));
  cin >> n;
  parts.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> parts[i].first.second >> parts[i].first.first;
    parts[i].second = i;
  }
  sort(parts.begin(), parts.end());
  cin >> m;
  actors.resize(m);
  for (long long i = 0; i < m; i++) {
    cin >> actors[i].first.second >> actors[i].first.first >> k[i];
    actors[i].second = i;
  }
  sort(actors.begin(), actors.end());
  long long p = 0;
  for (long long i = 0; i < m; i++) {
    long long en = actors[i].first.first, st = actors[i].first.second,
              in = actors[i].second;
    while (p < n && parts[p].first.first <= en) {
      s.insert({parts[p].first.second, parts[p].second});
      p++;
    }
    if (s.empty()) continue;
    set<pair<long long, long long> >::iterator it = s.lower_bound({st, 0});
    long long count = k[in];
    while (count && it != s.end()) {
      ans[it->second] = in;
      it = s.erase(it);
      count--;
    }
  }
  if (p == n && s.empty()) {
    cout << "YES\n";
    for (long long i = 0; i < n; i++) {
      cout << ans[i] + 1 << " ";
    }
  } else
    cout << "NO\n";
  return 0;
}
