#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &t) {
  os << "[";
  for (__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++) {
    if (it != t.begin()) os << ",";
    os << *it;
  }
  os << "]";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &t) {
  os << "{";
  for (__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++) {
    if (it != t.begin()) os << ",";
    os << *it;
  }
  os << "}";
  return os;
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) {
  return os << "(" << t.first << "," << t.second << ")";
}
const int INF = 1 << 28;
const double EPS = 1e-8;
const int MOD = 1000000007;
int n, m;
int main() {
  scanf("%d", &n);
  vector<pair<int, pair<int, int>>> ev;
  vector<int> sx(n + 1);
  for (int i = 1; i <= (int)(n); i++) {
    int x, y;
    scanf("%d%d", &sx[i], &y);
    ev.emplace_back(y, pair<int, int>(1, i));
  }
  scanf("%d", &m);
  vector<int> x(m + 1);
  vector<int> k(m + 1);
  for (int i = 1; i <= (int)(m); i++) {
    int y;
    scanf("%d%d%d", &x[i], &y, &k[i]);
    ev.emplace_back(y, pair<int, int>(2, i));
  }
  sort(ev.begin(), ev.end());
  multimap<int, int> songs;
  vector<int> ans(n + 1);
  for (__typeof((ev).begin()) it = (ev).begin(); it != (ev).end(); it++) {
    const int i = it->second.second;
    const int t = it->second.first;
    if (t == 1) {
      songs.insert(pair<int, int>(sx[i], i));
    }
    if (t == 2) {
      auto it = songs.lower_bound(x[i]);
      for (int j = 0; j < (int)(k[i]); j++) {
        if (it == songs.end()) break;
        ans[it->second] = i;
        it = songs.erase(it);
      }
    }
  }
  if (!songs.empty()) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
    for (int i = 1; i <= (int)(n); i++) cout << ans[i] << " ";
  }
  return 0;
}
