#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c *x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug &operator<<(const c &) {
    return *this;
  }
};
clock_t time_c = clock();
void timeElapsed() {
  time_c = clock() - time_c;
  cerr << " [Time Elapsed: " << (float)(time_c) / CLOCKS_PER_SEC << "]\n";
}
struct event {
  int ind;
  int l;
  int r;
  int type;
  event(int ind, int l, int r, int type) : ind(ind), l(l), r(r), type(type) {}
  bool operator<(const event &e) const {
    return vector<int>({r, 1 - type, ind}) <
           vector<int>({e.r, 1 - e.type, e.ind});
  }
};
bool cmpEvents(const event &e1, const event &e2) {
  return make_pair(e1.l, e1.type) < make_pair(e2.l, e2.type);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<event> events;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    event e(i, a, b, 1);
    events.push_back(e);
  }
  int m;
  cin >> m;
  vector<int> capacity(m);
  for (int i = 0; i < m; i++) {
    int c, d, k;
    cin >> c >> d >> k;
    event e(i, c, d, 0);
    events.push_back(e);
    capacity[i] = k;
  }
  sort(events.begin(), events.end(), cmpEvents);
  set<event> actors;
  vector<int> ans(n);
  bool bad = 0;
  for (auto e : events) {
    if (e.type == 0) {
      actors.insert(e);
    } else {
      auto actor = actors.lower_bound(e);
      if (actor == actors.end()) {
        bad = 1;
        break;
      } else {
        ans[e.ind] = actor->ind + 1;
        capacity[actor->ind]--;
        if (capacity[actor->ind] == 0) {
          actors.erase(actor);
        }
      }
    }
  }
  if (bad) {
    cout << "NO";
  } else {
    cout << "YES\n";
    for (int x : ans) cout << x << " ";
    cout << "\n";
  }
}
