#include <bits/stdc++.h>
using namespace std;
int N, M;
int ans[100010];
int a[100010], b[100010];
int c[100010], d[100010], cnt[100010];
set<pair<int, int> > s;
int x[100010 * 4], nx;
vector<int> A[100010 * 4], B[100010 * 4];
bool solve() {
  for (int i = 0; i < N; i++) {
    x[nx++] = a[i];
    x[nx++] = b[i];
  }
  for (int i = 0; i < M; i++) {
    x[nx++] = c[i];
    x[nx++] = d[i];
  }
  sort(x, x + nx);
  nx = unique(x, x + nx) - x;
  for (int i = 0; i < M; i++) {
    c[i] = lower_bound(x, x + nx, c[i]) - x;
    d[i] = lower_bound(x, x + nx, d[i]) - x;
    A[c[i]].push_back(-(i + 1));
    B[d[i]].push_back(-(i + 1));
  }
  for (int i = 0; i < N; i++) {
    a[i] = lower_bound(x, x + nx, a[i]) - x;
    b[i] = lower_bound(x, x + nx, b[i]) - x;
    A[a[i]].push_back(i + 1);
  }
  memset(ans, -1, sizeof(ans));
  for (int i = 0; i < nx; i++) {
    int n;
    n = A[i].size();
    for (int j = 0; j < n; j++) {
      if (A[i][j] > 0) {
        int k = A[i][j] - 1;
        set<pair<int, int> >::iterator it =
            s.lower_bound(pair<int, int>(b[k], -1));
        if (it == s.end()) return false;
        int u = it->second;
        ans[k] = u + 1;
        cnt[u]--;
        if (!cnt[u]) s.erase(it);
      } else {
        int k = -A[i][j] - 1;
        s.insert(pair<int, int>(d[k], k));
      }
    }
    n = B[i].size();
    for (int j = 0; j < n; j++) {
      int k = -B[i][j] - 1;
      s.erase(pair<int, int>(d[k], k));
    }
  }
  return true;
}
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%d%d", &a[i], &b[i]);
  scanf("%d", &M);
  for (int i = 0; i < M; i++) scanf("%d%d%d", &c[i], &d[i], &cnt[i]);
  if (solve()) {
    puts("YES");
    for (int i = 0; i < N; i++) printf("%d ", ans[i]);
    puts("");
  } else
    puts("NO");
  return 0;
}
