#include <bits/stdc++.h>
using namespace std;
struct p {
  long long c;
  long long d;
  long long k;
  long long ind;
};
struct k : public pair<long long, long long> {
  long long ind;
};
bool uporedi(p a, p b) {
  if (a.c != b.c) return a.c < b.c;
  if (a.d != b.d) return a.d < b.d;
  return a.k < b.k;
}
void no() {
  cout << "NO\n";
  exit(0);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  long long n;
  cin >> n;
  vector<k> a(n);
  long long t = 0;
  for (auto& i : a) {
    cin >> i.first >> i.second;
    i.ind = t++;
  }
  long long m;
  cin >> m;
  vector<p> b(m);
  long long tmp = 0;
  for (auto& i : b) {
    cin >> i.c >> i.d >> i.k;
    i.ind = tmp++;
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end(), uporedi);
  long long j = 0;
  set<pair<long long, long long> > r;
  vector<long long> sol(n);
  for (auto& i : a) {
    while (j < m && b[j].c <= i.first) {
      r.insert({b[j].d, j});
      ++j;
    }
    auto it = r.lower_bound({i.second, 0});
    if (it == r.end()) no();
    auto q = *it;
    sol[i.ind] = (q.second);
    --b[q.second].k;
    if (!b[q.second].k) r.erase({b[q.second].d, q.second});
  }
  long long len = sol.size();
  if (len != n) no();
  for (auto& i : sol) {
    if (i < 0 || i > m - 1) no();
  }
  cout << "YES\n";
  for (auto& i : sol) cout << b[i].ind + 1 << ' ';
  cout << '\n';
}
