#include <bits/stdc++.h>
const int N = (int)1e5 + 228;
const int PERSON = 1;
const int WORK = 0;
using namespace std;
struct Str {
  int l, r, type, id, k;
};
bool cmp(Str a, Str b) {
  return a.r < b.r || (a.r == b.r && a.type < b.type) ||
         (a.r == b.r && a.type == b.type && a.l < b.l);
}
int n, m, ans[N];
vector<Str> e;
set<pair<int, int> > st;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    e.push_back({l, r, WORK, i, 0});
  }
  int m;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    int l, r, k;
    scanf("%d%d%d", &l, &r, &k);
    e.push_back({l, r, PERSON, i, k});
  }
  sort(e.begin(), e.end(), &cmp);
  for (auto to : e) {
    if (to.type == WORK) {
      st.insert({to.l, to.id});
    } else {
      for (int i = 0; i < to.k; i++) {
        if (st.upper_bound({to.l, 0}) != st.end()) {
          pair<int, int> pp = *st.upper_bound({to.l, 0});
          ans[pp.second] = to.id;
          st.erase(pp);
        } else
          break;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (ans[i] == 0) {
      cout << "NO" << endl;
      return 0;
    }
  }
  printf("YES\n");
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
