#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 1e6 + 7;
const double PI = acos(-1);
const int mod = 1e9 + 7;
set<pair<int, int> > s;
pair<pair<int, int>, int> a[N], b[N];
int cnt[N], ans[N];
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].first.first, &a[i].first.second);
    a[i].second = i;
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &b[i].first.first, &b[i].first.second);
    b[i].second = i;
    scanf("%d", &cnt[i]);
  }
  sort(a + 1, a + n + 1);
  sort(b + 1, b + m + 1);
  int j = 1;
  for (int i = 1; i <= n; i++) {
    while (j <= m && b[j].first.first <= a[i].first.first) {
      s.insert(make_pair(b[j].first.second, b[j].second));
      j++;
    }
    set<pair<int, int> >::iterator it =
        s.lower_bound(make_pair(a[i].first.second, 0));
    if (it == s.end()) {
      cout << "NO" << endl;
      return 0;
    }
    cnt[it->second]--;
    ans[a[i].second] = it->second;
    if (!cnt[it->second]) s.erase(it);
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
