#include <bits/stdc++.h>
using namespace std;
struct seg {
  int ini, type, fin, cnt, ind;
  bool operator<(seg V) const {
    if (ini != V.ini) return ini < V.ini;
    if (type != V.type) return type < V.type;
    return fin < V.fin;
  }
};
int main() {
  int N, M;
  cin >> N;
  vector<seg> V;
  seg aux;
  for (int i = (0); i < (N); i++) {
    cin >> aux.ini >> aux.fin;
    aux.ind = i + 1;
    aux.type = 2;
    V.push_back(aux);
  }
  cin >> M;
  for (int i = (0); i < (M); i++) {
    cin >> aux.ini >> aux.fin >> aux.cnt;
    aux.ind = i + 1;
    aux.type = 1;
    V.push_back(aux);
  }
  sort((V).begin(), (V).end());
  set<pair<int, pair<int, int> > > S;
  set<pair<int, pair<int, int> > >::iterator it;
  pair<int, pair<int, int> > p;
  int ans[N];
  bool flag = 1;
  for (int i = (0); i < (V.size()); i++) {
    if (V[i].type == 1) {
      p.first = V[i].fin;
      p.second.first = V[i].ind;
      p.second.second = V[i].cnt;
      S.insert(p);
    } else {
      p.first = V[i].fin;
      p.second.first = -1;
      it = S.lower_bound(p);
      if (it == S.end()) {
        flag = 0;
        break;
      }
      p = *it;
      S.erase(it);
      ans[V[i].ind - 1] = p.second.first;
      if (p.second.second != 1) {
        p.second.second--;
        S.insert(p);
      }
    }
  }
  if (flag) {
    puts("YES");
    for (int i = (0); i < (N); i++) cout << ans[i] << " ";
  } else
    puts("NO");
}
