#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int a[maxn], b[maxn], k[maxn], c[maxn], d[maxn], ans[maxn];
set<pair<int, int> > s;
vector<pair<int, int> > v;
int main() {
  int n, m;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    v.push_back(make_pair(a[i], i));
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> c[i] >> d[i] >> k[i];
    v.push_back(make_pair(c[i], -i));
  }
  sort(v.begin(), v.end());
  set<pair<int, int> >::iterator it;
  for (int i = 0; i < n + m; i++) {
    int y = v[i].second;
    if (y < 0)
      s.insert(make_pair(d[-y], -y));
    else {
      it = s.lower_bound(make_pair(b[y], 0));
      if (it == s.end()) {
        cout << "NO" << endl;
        return 0;
      }
      ans[y] = it->second;
      if (--k[it->second] == 0) s.erase(it);
    }
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  cout << endl;
  return 0;
}
