#include <bits/stdc++.h>
using namespace std;
const int MX = 1e5 + 5;
int n, m, a[MX], b[MX], c[MX], d[MX], k[MX], x[MX], y[MX], res[MX];
set<pair<int, int> > st;
void no() {
  cout << "NO" << '\n';
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  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, k + i);
  iota(x, x + n, 0);
  sort(x, x + n, [](int i, int j) { return a[i] < a[j]; });
  iota(y, y + m, 0);
  sort(y, y + m, [](int i, int j) { return c[i] < c[j]; });
  for (int i = 0, j = 0; i < n; i++) {
    int u = x[i];
    while (j < m) {
      int v = y[j];
      if (c[v] <= a[u])
        st.emplace(d[v], v);
      else
        break;
      j++;
    }
    auto it = st.upper_bound(pair<int, int>(b[u], -1));
    if (it == st.end()) no();
    k[it->second]--;
    res[u] = it->second + 1;
    if (!k[it->second]) st.erase(it);
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) printf("%d ", res[i]);
  printf("\n");
  return 0;
}
