#include <bits/stdc++.h>
using namespace std;
int n, m;
struct node {
  int l, r, type, id;
};
bool comp(node n1, node n2) {
  if (n1.l != n2.l) return n1.l < n2.l;
  return n1.type > n2.type;
}
vector<node> V;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    node temp;
    temp.l = x;
    temp.r = y;
    temp.id = i + 1;
    temp.type = 1;
    V.push_back(temp);
  }
  scanf("%d", &m);
  int cnt[m + 1];
  memset(cnt, 0, sizeof cnt);
  for (int i = 0; i < m; i++) {
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);
    node temp;
    temp.l = x;
    temp.r = y;
    temp.id = i + 1;
    temp.type = 2;
    cnt[i + 1] = z;
    V.push_back(temp);
  }
  sort(V.begin(), V.end(), comp);
  set<pair<int, int> > S;
  int ans[n + 1];
  bool flag = true;
  for (int i = 0; i < V.size(); i++) {
    if (V[i].type == 2) {
      int right = V[i].r;
      int id2 = V[i].id;
      S.insert(make_pair(right, id2));
    } else {
      int right = V[i].r;
      int id2 = V[i].id;
      pair<int, int> P = make_pair(right, -1);
      set<pair<int, int> >::iterator it;
      it = S.lower_bound(P);
      if (it == S.end()) {
        flag = false;
        break;
      } else {
        pair<int, int> t = *it;
        cnt[t.second]--;
        if (cnt[t.second] == 0) S.erase(it);
        ans[id2] = t.second;
      }
    }
  }
  if (flag == false)
    cout << "NO";
  else {
    cout << "YES" << endl;
    for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  }
}
