#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, ans[N];
struct Node {
  int l, r, k, id;
} a[N], b[N];
inline bool operator<(const Node &a, const Node &b) { return a.r < b.r; }
set<pair<int, int>> s;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].l >> a[i].r, a[i].id = i;
  sort(a + 1, a + n + 1);
  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 + m + 1);
  for (int i = 1, p = 1; i <= m; i++) {
    while (p <= n && a[p].r <= b[i].r) s.insert({a[p].l, a[p].id}), ++p;
    while (b[i].k) {
      auto it = s.lower_bound({b[i].l, 0});
      if (it == s.end()) break;
      ans[it->second] = b[i].id;
      --b[i].k;
      s.erase(it);
    }
  }
  for (int i = 1; i <= n; i++)
    if (!ans[i]) {
      puts("NO");
      return 0;
    }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  return 0;
}
