#include <bits/stdc++.h>
using namespace std;
int n, m;
bool sorted = false;
struct act {
  int l, r, k, id;
  bool operator<(const act &t) const {
    if (!sorted) return l < t.l;
    return r < t.r;
  }
};
int main() {
  cin >> n;
  vector<act> arr(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", &arr[i].l, &arr[i].r);
    arr[i].id = i;
  }
  cin >> m;
  vector<act> actors(m);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d %d", &actors[i].l, &actors[i].r, &actors[i].k);
    actors[i].id = i + 1;
  }
  sort(arr.begin(), arr.end());
  sort(actors.begin(), actors.end());
  sorted = true;
  int l = 0;
  multiset<act> ready;
  vector<int> ans(n);
  for (int i = 0; i < n; ++i) {
    while (l < m && actors[l].l <= arr[i].l) ready.insert(actors[l++]);
    act comp;
    comp.r = arr[i].r;
    auto it = ready.lower_bound(comp);
    if (it == ready.end()) {
      cout << "NO\n";
      exit(0);
    }
    act nxt = *it;
    ans[arr[i].id] = nxt.id;
    ready.erase(it);
    --nxt.k;
    if (nxt.k > 0) ready.insert(nxt);
  }
  cout << "YES\n";
  for (int i = 0; i < n; ++i) cout << ans[i] << " \n"[i == n - 1];
}
