#include <bits/stdc++.h>
using namespace std;
struct node {
  int st, ed, k, index;
  bool operator<(const node nd) const {
    if (st != nd.st) return st < nd.st;
    if (k != nd.k) return k > nd.k;
    return ed < nd.ed;
  }
};
int main() {
  int n, m;
  cin >> n;
  vector<node> v;
  vector<int> ans;
  map<pair<int, int>, int> Map;
  ans.resize(200000);
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    v.push_back(node{a, b, 0, i + 1});
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    int a, b, k;
    cin >> a >> b >> k;
    v.push_back(node{a, b, k, i + 1});
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    if (v[i].k > 0)
      Map[{v[i].ed, v[i].index}] = v[i].k;
    else {
      auto it = Map.lower_bound(make_pair(v[i].ed, -1));
      if (it == Map.end()) {
        cout << "NO\n";
        return 0;
      } else {
        it->second--;
        ans[v[i].index] = it->first.second;
        if (it->second == 0) {
          Map.erase(it);
        }
      }
    }
  }
  cout << "YES\n";
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << ' ';
  }
  return 0;
}
