#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
struct event {
  int a, b;
  int type;
  int ind;
  event(int a, int b, int type, int ind) {
    this->a = a;
    this->b = b;
    this->type = type;
    this->ind = ind;
  }
};
bool cmp(event &x, event &y) {
  if (x.a != y.a) return x.a < y.a;
  if (x.type != y.type) return x.type > y.type;
  if (x.b != y.b) return x.b < y.b;
  return x.ind < y.ind;
}
int n, m;
vector<event> v;
set<pair<int, int> > s;
int ks[maxn];
int sol[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    v.push_back(event(x, y, 0, i));
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    int x, y, k;
    scanf("%d%d%d", &x, &y, &k);
    v.push_back(event(x, y, 1, i));
    ks[i] = k;
  }
  sort(v.begin(), v.end(), cmp);
  for (int i = 0; i < v.size(); i++) {
    event tren = v[i];
    while (!s.empty() && s.begin()->first < tren.a) s.erase(s.begin());
    if (tren.type == 1) {
      s.insert(make_pair(tren.b, tren.ind));
    } else {
      auto iter = s.lower_bound(make_pair(tren.b, -inf));
      if (iter == s.end()) {
        printf("NO\n");
        return 0;
      }
      sol[tren.ind] = iter->second + 1;
      if (--ks[iter->second] == 0) s.erase(iter);
    }
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) printf("%d ", sol[i]);
  return 0;
}
