#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:536870912")
#pragma warning(disable : 4996)
using namespace std;
const int N = 1e5 + 100;
map<int, vector<pair<int, int>>> mp;
pair<pair<int, int>, int> a[N];
pair<pair<int, int>, pair<int, int>> d[N];
int t[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i].first.first, &a[i].first.second);
    a[i].second = i;
  }
  sort(a, a + n);
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &d[i].first.first, &d[i].first.second, &d[i].second.first);
    d[i].second.second = i;
  }
  sort(d, d + m);
  int j = 0;
  for (int i = 0; i < n; i++) {
    while (j < m && d[j].first.first <= a[i].first.first) {
      mp[d[j].first.second].push_back({d[j].second.second, d[j].second.first});
      j++;
    }
    auto it = mp.lower_bound(a[i].first.second);
    if (it == mp.end()) {
      printf("NO");
      return 0;
    }
    it->second.back().second--;
    t[a[i].second] = it->second.back().first + 1;
    if (it->second.back().second == 0) {
      it->second.pop_back();
      if (it->second.empty()) mp.erase(it);
    }
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) printf("%d ", t[i]);
  return 0;
}
