#include <bits/stdc++.h>
using namespace std;
struct node {
  int l, r, id, type;
  node(int l = 0, int r = 0, int id = 0, int type = 0)
      : l(l), r(r), id(id), type(type) {}
  bool operator<(node b) const {
    if (l == b.l) return type < b.type;
    return l < b.l;
  }
};
int n, m;
int lt[234567], rt[234567];
vector<node> v;
int k[234567], ans[234567];
set<pair<int, int> > s;
set<pair<int, int> >::iterator it;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    v.push_back(node(x, y, i, 1));
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &lt[i], &rt[i], &k[i]);
    v.push_back(node(lt[i], rt[i], i, 0));
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    if (v[i].type == 0)
      s.insert(make_pair(v[i].r, v[i].id));
    else {
      it = s.lower_bound(make_pair(v[i].r, 0));
      if (it == s.end()) {
        puts("NO");
        return 0;
      }
      int tmp = it->second;
      ans[v[i].id] = tmp;
      s.erase(it);
      k[tmp]--;
      if (k[tmp]) s.insert(make_pair(rt[tmp], tmp));
    }
  }
  puts("YES");
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
