#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T getNext() {
  T s = 1, x = 0, c = getc(stdin);
  while (c <= 32) c = getc(stdin);
  if (c == '-') s = -1, c = getc(stdin);
  while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getc(stdin);
  return x * s;
}
struct reader {
  template <typename T>
  reader& operator,(T& v) {
    v = getNext<T>();
    return *this;
  }
} rdr;
const double eps = 1e-9;
bool Equals(double x, double y) { return abs(x - y) < eps; }
bool Less(double x, double y) { return (x) < y - eps; }
bool LessOrEqual(double x, double y) { return (x) < y + eps; }
const int MaxN = int(1e5) + 256;
struct event {
  int tp, pt, ind;
  event(int tp, int pt, int ind) : tp(tp), pt(pt), ind(ind) {}
  bool operator<(event t) const {
    if (t.pt == pt) return t.tp > tp;
    return t.pt > pt;
  }
};
int a[MaxN], b[MaxN], aa[MaxN], bb[MaxN], k[MaxN], res[MaxN];
vector<event> v;
int main() {
  int n;
  rdr, n;
  ;
  for (int i = 1; i <= n; ++i) {
    a[i] = getNext<int>(), b[i] = getNext<int>();
    v.push_back(event(2, a[i], i));
    v.push_back(event(3, b[i], i));
  }
  int m;
  rdr, m;
  ;
  for (int i = 1; i <= m; ++i) {
    aa[i] = getNext<int>(), bb[i] = getNext<int>(), k[i] = getNext<int>();
    v.push_back(event(1, aa[i], i));
    v.push_back(event(4, bb[i], i));
  }
  sort(v.begin(), v.end());
  set<pair<int, int> > S;
  for (int i = 0; i < v.size(); ++i) {
    event cur = v[i];
    int w = cur.ind;
    if (cur.tp == 3) continue;
    if (cur.tp == 1) {
      S.insert(make_pair(bb[w], w));
    } else {
      if (cur.tp == 4) {
        S.erase(make_pair(bb[w], w));
      } else {
        if (S.empty() || b[w] > S.rbegin()->first) {
          puts("NO");
          return 0;
        }
        auto it = S.lower_bound(make_pair(b[w], 0));
        if (b[w] > (it->first)) ++it;
        int p = it->second;
        S.erase(make_pair(bb[p], p));
        k[p]--;
        res[w] = p;
        if (k[p]) S.insert(make_pair(bb[p], p));
      }
    }
  }
  puts("YES");
  for (int i = 1; i <= n; ++i) cout << res[i] << " ";
  return 0;
}
