#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, z, i, j, k, l, F = 1, ans[100005];
pair<int, pair<int, int> > a[100005];
vector<pair<pair<int, int>, pair<int, int> > > v;
set<pair<int, pair<int, int> > > st;
set<pair<int, pair<int, int> > >::iterator it;
pair<int, pair<int, int> > w;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i].first >> a[i].second.first, a[i].second.second = i + 1;
  sort(a, a + n);
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> x >> y >> z;
    v.push_back(make_pair(make_pair(x, y), make_pair(z, i)));
  }
  sort(v.begin(), v.end());
  j = 0;
  for (int i = 0; i < n; i++) {
    while (j < m && v[j].first.first <= a[i].first)
      st.insert(make_pair(v[j].first.second,
                          make_pair(v[j].second.second, v[j].second.first))),
          j++;
    it = st.lower_bound(make_pair(a[i].second.first, make_pair(0, 0)));
    if (it == st.end()) {
      F = 0;
      break;
    }
    w = (*it);
    st.erase(w);
    if (w.second.second > 1) {
      w.second.second--;
      st.insert(w);
    }
    ans[a[i].second.second] = w.second.first + 1;
  }
  if (F == 0) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
  cin >> n >> n;
}
