#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
const int N = 1e5 + 5;
int n, m;
struct node {
  int l, r, k, id;
  bool operator<(const node &t) const { return r < t.r; }
} a[N], b[N];
bool cmp(node n1, node n2) { return n1.r < n2.r; }
struct point {
  int x, id;
  point() {}
  point(int x, int id) : x(x), id(id) {}
  bool operator<(const point &t) const {
    if (x == t.x) return id < t.id;
    return x < t.x;
  }
};
set<point> s;
int d[N];
int main() {
  std::ios::sync_with_stdio(0);
  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(a + 1, a + 1 + n);
  sort(b + 1, b + 1 + m);
  int ans = 0;
  int j = 0;
  for (int i = 1; i <= m; i++) {
    while (j <= n && a[j].r <= b[i].r) {
      s.insert(point(a[j].l, a[j].id));
      j++;
    }
    set<point>::iterator it;
    for (int k = 1; k <= b[i].k; k++) {
      it = s.lower_bound(point(b[i].l, -1));
      if (it == s.end()) break;
      point tmp = *it;
      d[tmp.id] = b[i].id;
      s.erase(tmp);
      ans++;
    }
  }
  if (ans < n)
    cout << "NO" << endl;
  else {
    cout << "YES" << endl;
    for (int i = 1; i <= n; i++) {
      cout << d[i] << " ";
    }
  }
}
