#include <bits/stdc++.h>
using namespace std;
struct data {
  int usage, left, right, id;
  bool operator<(const data& a2) const {
    if (left != a2.left) return left < a2.left;
    return right < a2.right;
  }
};
int main() {
  int N, M, a, b, c, d, k;
  vector<data> actors, parts;
  set<pair<int, int> > sActors;
  cin >> N;
  for (int n = 0; n < N; n++) {
    cin >> a >> b;
    parts.push_back(data{0, a, b, n});
  }
  cin >> M;
  for (int m = 0; m < M; m++) {
    cin >> c >> d >> k;
    actors.push_back(data{k, c, d, m + 1});
  }
  sort(parts.begin(), parts.end());
  sort(actors.begin(), actors.end());
  int ai = 0;
  vector<int> result(N);
  for (data const& part : parts) {
    while (ai < M && actors[ai].left <= part.left) {
      sActors.insert(pair<int, int>(actors[ai].right, ai));
      ai++;
    }
    auto ac = sActors.lower_bound(pair<int, int>(part.right, 0));
    if (ac == sActors.end()) {
      cout << "NO\n";
      return 0;
    }
    result[part.id] = actors[ac->second].id;
    if (!--actors[ac->second].usage) sActors.erase(ac);
  }
  cout << "YES\n";
  bool space = false;
  for (int i : result) {
    if (space) cout << ' ';
    space = true;
    cout << i;
  }
  cout << endl;
}
