#include <bits/stdc++.h>
struct music {
  int b;
  int e;
  int k;
  int ind;
};
bool operator<(const music& x, const music& y) {
  if (x.b == y.b) return x.k > y.k;
  return x.b < y.b;
}
int main() {
  int n, m;
  int b, e, k;
  int mmatch[100000];
  std::vector<music> mvector;
  std::map<std::pair<int, int>, int> mmap;
  std::cin >> n;
  mvector.reserve(n);
  for (int i = 0; i < n; i++) {
    std::cin >> b >> e;
    mvector.push_back({b, e, -1, i});
  }
  std::cin >> m;
  mvector.reserve(n + m);
  for (int i = 0; i < m; i++) {
    std::cin >> b >> e >> k;
    mvector.push_back({b, e, k, i + 1});
  }
  std::sort(mvector.begin(), mvector.end());
  for (const auto& iter : mvector) {
    if (iter.k > 0) {
      mmap[{iter.e, iter.ind}] = iter.k;
    } else {
      auto iter1 = mmap.lower_bound({iter.e, -1});
      if (iter1 == mmap.end()) {
        std::cout << "NO" << std::endl;
        return 0;
      }
      mmatch[iter.ind] = iter1->first.second;
      if (iter1->second == 1)
        mmap.erase(iter1);
      else
        iter1->second -= 1;
    }
  }
  std::cout << "YES" << std::endl;
  for (int i = 0; i < n; i++) std::cout << mmatch[i] << " ";
  return 0;
}
