#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int N = 200000;
int n, m;
struct event {
  int L, R, t, number, cnt;
  event(int l, int r, int T, int num, int cn) {
    L = l;
    R = r;
    t = T;
    number = num;
    cnt = cn;
  }
};
int answer[N];
vector<event> events;
bool cmp(event a, event b) {
  if (a.L < b.L) return true;
  if (a.L > b.L) return false;
  if (a.t < b.t) return true;
  return false;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    events.push_back(event(a, b, 1, i, 0));
  }
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    events.push_back(event(a, b, 0, i, c));
  }
  sort(events.begin(), events.end(), cmp);
  set<pair<int, pair<int, int> > > S;
  for (int i = 0; i < events.size(); ++i) {
    event cur = events[i];
    if (cur.t == 0) {
      S.insert(make_pair(cur.R, make_pair(cur.cnt, cur.number)));
    } else {
      set<pair<int, pair<int, int> > >::iterator cpointer =
          S.upper_bound(make_pair(cur.R - 1, make_pair(INF + 1, 0)));
      if (cpointer == S.end()) {
        puts("NO");
        return 0;
      }
      pair<int, pair<int, int> > tmp = (*cpointer);
      answer[cur.number] = tmp.second.second;
      S.erase(tmp);
      tmp.second.first--;
      if (tmp.second.first) S.insert(tmp);
    }
  }
  puts("YES");
  for (int i = 0; i < n; ++i) {
    if (i) printf(" ");
    printf("%d", answer[i] + 1);
  }
  printf("\n");
  return 0;
}
