#include <bits/stdc++.h>
using namespace std;
struct node {
  int a, b, idx;
  bool operator<(const node& o) const { return a < o.a; }
};
node part[100005], actor[100005];
int rest[100005];
int ans[100005];
bool solve(int n, int m) {
  map<int, set<int> > Q;
  map<int, set<int> >::iterator it;
  sort(part, part + n);
  sort(actor, actor + m);
  int j = -1;
  for (int i = 0; i < n; i++) {
    while (j + 1 < m && actor[j + 1].a <= part[i].a) {
      Q[actor[j + 1].b].insert(actor[j + 1].idx);
      j++;
    }
    it = Q.lower_bound(part[i].b);
    if (it == Q.end()) {
      return false;
    }
    int k = *((it->second).begin());
    ans[part[i].idx] = k;
    rest[k]--;
    if (rest[k] == 0) {
      (it->second).erase(k);
      if ((it->second).empty()) {
        Q.erase(it);
      }
    }
  }
  return true;
}
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &part[i].a, &part[i].b);
    part[i].idx = i;
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &actor[i].a, &actor[i].b, &rest[i]);
    actor[i].idx = i;
  }
  if (solve(n, m)) {
    printf("YES\n");
    for (int i = 0; i < n; i++) printf("%d ", ans[i] + 1);
  } else {
    printf("NO\n");
  }
  return 0;
}
