#include <bits/stdc++.h>
using namespace std;
struct node {
  int a, b, id;
} parts[100005];
struct node1 {
  int c, d, id;
} musician[100005];
int k[100005];
int ans[100005];
set<pair<int, int> > s;
set<pair<int, int> >::iterator it;
bool cmp(node x, node y) { return x.a < y.a; }
bool cmp1(node1 x, node1 y) { return x.c < y.c; }
int main() {
  int n, m, i, j;
  while (cin >> n) {
    for (i = 1; i <= n; i++) {
      cin >> parts[i].a >> parts[i].b;
      parts[i].id = i;
    }
    sort(parts + 1, parts + 1 + n, cmp);
    cin >> m;
    for (i = 1; i <= m; i++) {
      cin >> musician[i].c >> musician[i].d >> k[i];
      musician[i].id = i;
    }
    sort(musician + 1, musician + 1 + m, cmp1);
    s.clear();
    j = 1;
    for (i = 1; i <= n; i++) {
      while (j <= m && musician[j].c <= parts[i].a) {
        s.insert(make_pair(musician[j].d, musician[j].id));
        j++;
      }
      it = s.lower_bound(make_pair(parts[i].b, 0));
      if ((*it).first >= parts[i].b) {
        ans[parts[i].id] = (*it).second;
        k[ans[parts[i].id]]--;
        if (k[ans[parts[i].id]] == 0) {
          s.erase(*it);
        }
      } else
        break;
    }
    if (i <= n) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
      for (i = 1; i <= n; i++) {
        if (i < n)
          cout << ans[i] << " ";
        else
          cout << ans[i] << endl;
      }
    }
  }
}
