#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
struct PP {
  int l, r, k;
  int rank, ans;
  bool operator<(const PP& b) const {
    if (r == b.r) return l < b.l;
    return r < b.r;
  }
} a[MAXN], b[MAXN];
struct Point {
  int l, r, rank;
  bool operator<(const Point& b) const {
    if (l == b.l) {
      if (r == b.r) return rank < b.rank;
      return r < b.r;
    }
    return l < b.l;
  }
};
int n, m;
int res[MAXN];
void input() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].l >> a[i].r;
    a[i].rank = i;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> b[i].l >> b[i].r >> b[i].k;
    b[i].rank = i;
  }
}
bool cmp(const PP& a, const PP& b) { return a.rank < b.rank; }
void solve() {
  sort(a, a + n);
  sort(b, b + m);
  set<Point> s;
  int cnt = n;
  for (int i = 0, j = 0; i < m; i++) {
    while (j < n && a[j].r <= b[i].r) {
      s.insert((Point){a[j].l, a[j].r, j});
      j++;
    }
    for (int z = 0; z < b[i].k; z++) {
      auto it = s.lower_bound((Point){b[i].l, 0, 0});
      if (it == s.end()) break;
      a[it->rank].ans = b[i].rank + 1;
      s.erase(it);
      cnt--;
    }
  }
  if (s.size() != 0 || cnt != 0) {
    cout << "NO" << endl;
    return;
  }
  sort(a, a + n, cmp);
  cout << "YES" << endl;
  cout << a[0].ans;
  for (int i = 1; i < n; i++) cout << " " << a[i].ans;
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  input();
  solve();
  return 0;
}
