#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
struct actor {
  actor() : k(0), l(0), r(0), num(0){};
  int k, l, r, num;
};
struct part {
  part() : l(0), r(0), num(0){};
  int l, r, num;
};
bool part_cmp_l(const part& lt, const part& rt) {
  return (lt.l < rt.l) || (lt.l == rt.l && lt.r < rt.r);
}
bool act_cmp_l(const actor& lt, const actor& rt) {
  return (lt.l < rt.l) || (lt.l == rt.l && lt.r < rt.r);
}
struct act_cmp_r {
  bool operator()(const actor& lt, const actor& rt) const {
    return (lt.r < rt.r) || (lt.r == rt.r && lt.l < rt.l) ||
           (lt.r == rt.r && lt.l == rt.l && lt.num < rt.num);
  }
};
int main(int argc, const char* argv[]) {
  srand((unsigned)time(0));
  int n;
  cin >> n;
  vector<part> P(n);
  for (int i = 0; i < n; ++i) {
    cin >> P[i].l >> P[i].r;
    P[i].num = i;
  }
  sort(P.begin(), P.end(), part_cmp_l);
  int m;
  cin >> m;
  vector<actor> A(m);
  for (int i = 0; i < m; ++i) {
    cin >> A[i].l >> A[i].r >> A[i].k;
    A[i].num = i;
  }
  sort(A.begin(), A.end(), act_cmp_l);
  map<actor, int, act_cmp_r> S;
  int l = 0;
  actor help_actor;
  vector<int> ans(n);
  for (int i = 0; i < n; ++i) {
    while (l < m && A[l].l <= P[i].l) {
      S.insert(make_pair(A[l], A[l].k));
      ++l;
    }
    help_actor.r = P[i].l;
    S.erase(S.begin(), S.lower_bound(help_actor));
    help_actor.r = P[i].r;
    map<actor, int, act_cmp_r>::iterator it = S.lower_bound(help_actor);
    if (it == S.end()) {
      cout << "NO" << endl;
      return 0;
    }
    it->second--;
    ans[P[i].num] = it->first.num + 1;
    if (it->second == 0) S.erase(it->first);
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; ++i) cout << ans[i] << " ";
  return 0;
}
