#include <bits/stdc++.h>
const int N = 100100;
using namespace std;
int n, m, ans[N], k[N];
pair<pair<int, int>, int> a[N], b[N];
set<pair<int, int> > s;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first.first >> a[i].first.second;
    a[i].second = i;
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> b[i].first.first >> b[i].first.second >> k[i];
    b[i].second = i;
  }
  sort(a + 1, a + n + 1);
  sort(b + 1, b + m + 1);
  for (int i = 1, j = 1; i <= n; i++) {
    while (b[j].first.first <= a[i].first.first && j <= m) {
      s.insert({b[j].first.second, b[j].second});
      j++;
    }
    if (s.empty()) {
      cout << "NO" << endl;
      return 0;
    }
    auto it = s.lower_bound({a[i].first.second, -1});
    if (it == s.end()) {
      cout << "NO" << endl;
      return 0;
    }
    ans[a[i].second] = it->second;
    k[it->second]--;
    if (k[it->second] == 0) s.erase(it);
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
}
