#include <bits/stdc++.h>
using namespace std;
struct interval {
  int L, R, K;
  int id;
};
bool lf1(const interval& x, const interval& y) { return x.R < y.R; }
const int maxn = 1e5 + 5;
interval a[maxn], b[maxn];
int N, M;
set<pair<int, int>> s;
int ans[maxn];
signed main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (fopen("SINGER"
            ".INP",
            "r")) {
    freopen(
        "SINGER"
        ".INP",
        "r", stdin);
    freopen(
        "SINGER"
        ".OUT",
        "w", stdout);
  }
  cin >> N;
  for (int i = 1; i <= N; ++i) cin >> a[i].L >> a[i].R, a[i].id = i;
  cin >> M;
  for (int i = 1; i <= M; ++i) cin >> b[i].L >> b[i].R >> b[i].K, b[i].id = i;
  sort(b + 1, b + 1 + M, lf1);
  sort(a + 1, a + 1 + N, lf1);
  int i = 1, j = 1, ok = 1;
  while (j <= M) {
    if (i <= N && a[i].R <= b[j].R) {
      s.insert({a[i].L, a[i].id});
      ++i;
    } else {
      auto it = s.lower_bound({b[j].L, 0});
      if (it == s.end()) {
        if (j == M && s.size() > 0) {
          break;
        } else {
          ++j;
          continue;
        }
      }
      ans[it->second] = b[j].id;
      s.erase(it);
      b[j].K--;
      if (b[j].K == 0) ++j;
    }
  }
  for (int i = 1; i <= N; ++i) {
    if (ans[i] == 0) ok = 0;
  }
  if (ok == 1) {
    cout << "YES" << '\n';
    for (int i = 1; i <= N; ++i) cout << ans[i] << ' ';
  } else {
    cout << "NO";
  }
}
