#include <bits/stdc++.h>
const int mod = 1e9 + 7;
const int maxn = 2e5 + 5;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) {
    int n;
    cin >> n;
    vector<pair<pair<int, int>, int> > a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i].first.first >> a[i].first.second;
      a[i].second = i;
    }
    int m;
    cin >> m;
    int k[m];
    vector<pair<pair<int, int>, int> > b(m);
    for (int i = 0; i < m; i++) {
      cin >> b[i].first.first >> b[i].first.second >> k[i];
      b[i].second = i;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    set<pair<int, int> > s;
    int ans[n];
    int flag = 0;
    int j = 0;
    for (int i = 0; i < n; i++) {
      while (j < m && b[j].first.first <= a[i].first.first) {
        s.insert({b[j].first.second, b[j].second});
        j++;
      }
      if (s.empty()) {
        cout << "NO\n";
        return 0;
      }
      auto it = s.lower_bound({a[i].first.second, 0});
      if (it == s.end()) {
        cout << "NO\n";
        return 0;
      }
      ans[a[i].second] = it->second;
      k[it->second]--;
      if (k[it->second] == 0) s.erase(it);
    }
    cout << "YES\n";
    for (int i = 0; i < n; i++) cout << ans[i] + 1 << " ";
  }
  return 0;
}
