#include <bits/stdc++.h>
using namespace std;
int i, j, n, m, p, t, s;
int a[200000], b[200000], c[200000], d[200000], k[200000];
struct inter {
  int l, r, nom, cnt;
  inter() {}
  inter(int _l, int _r, int _nom, int _cnt) {
    l = _l;
    r = _r;
    nom = _nom;
    cnt = _cnt;
  }
};
bool operator<(inter a, inter b) {
  return a.l > b.l || a.l == b.l && a.r > b.r;
}
int ans[200000];
inter singers[200000];
inter songs[200000];
set<pair<int, int> > st;
set<pair<int, int> >::iterator it;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    songs[i] = inter(a[i], b[i], i, 0);
  }
  cin >> m;
  for (i = 0; i < m; i++) {
    scanf("%d%d%d", &c[i], &d[i], &k[i]);
    singers[i] = inter(c[i], d[i], i, k[i]);
  }
  sort(songs, songs + n);
  sort(singers, singers + m);
  j = 0;
  for (i = 0; i < m; i++) {
    while (j < n && songs[j].l >= singers[i].l) {
      st.insert(make_pair(songs[j].r, songs[j].nom));
      j++;
    }
    while (singers[i].cnt > 0) {
      if (st.size() == 0) break;
      it = st.lower_bound(make_pair(singers[i].r, -1));
      if (it == st.end()) {
        it--;
        ans[it->second] = singers[i].nom + 1;
        singers[i].cnt--;
        st.erase(it);
      } else {
        if (it->first > singers[i].r) {
          if (it == st.begin()) break;
          it--;
        }
        ans[it->second] = singers[i].nom + 1;
        singers[i].cnt--;
        st.erase(it);
      }
    }
  }
  for (i = 0; i < n; i++)
    if (ans[i] == 0) {
      cout << "NO\n";
      return 0;
    }
  cout << "YES\n";
  for (i = 0; i < n; i++) {
    printf("%d ", ans[i]);
  }
  cout << endl;
  return 0;
}
