#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long llinf = (1LL << 62);
const int inf = (1 << 30);
const int nmax = 1e5 + 50;
const int mod = 1e9 + 7;
using namespace std;
int n, m, i, j, x, y, rs[nmax], t;
pair<pair<int, int>, int> a[nmax];
pair<pair<int, int>, pair<int, int> > b[nmax];
set<pair<pair<int, int>, int> > s;
set<pair<pair<int, int>, int> >::iterator it;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i].first.first >> a[i].first.second;
    a[i].second = i;
  }
  cin >> m;
  for (i = 1; i <= m; i++) {
    cin >> b[i].first.first >> b[i].first.second >> b[i].second.first;
    b[i].second.second = i;
  }
  sort(a + 1, a + n + 1);
  sort(b + 1, b + m + 1);
  j = 1;
  for (i = 1; i <= n; i++) {
    x = a[i].first.first, y = a[i].first.second, t = a[i].second;
    for (; j <= m; j++) {
      if (b[j].first.first > x) break;
      s.insert(make_pair(make_pair(b[j].first.second, b[j].second.first),
                         b[j].second.second));
    }
    it = s.lower_bound(make_pair(make_pair(y, 0), 0));
    if (it == s.end()) return cout << "NO" << endl, 0;
    rs[t] = it->second;
    x = it->first.first, y = it->first.second - 1, t = it->second;
    s.erase(it);
    if (y) s.insert(make_pair(make_pair(x, y), t));
  }
  cout << "YES" << endl;
  for (i = 1; i <= n; i++) cout << rs[i] << " ";
  cout << endl;
  return 0;
}
