#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
pair<pair<int, int>, int> a[N];
pair<pair<int, int>, pair<int, int> > b[N];
set<pair<int, int> > s;
int cnt[N];
int ans[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x, y;
    scanf("%d %d", &x, &y);
    a[i] = make_pair(make_pair(x, y), i);
  }
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);
    b[i] = make_pair(make_pair(x, y), make_pair(z, i));
  }
  sort(a, a + n);
  sort(b, b + m);
  memset(cnt, 0, sizeof cnt);
  s.clear();
  for (int i = 0, j = 0; i < n; ++i) {
    while (j < m && b[j].first.first <= a[i].first.first) {
      cnt[b[j].second.second] = b[j].second.first;
      s.insert(make_pair(b[j].first.second, b[j].second.second));
      ++j;
    }
    set<pair<int, int> >::iterator it =
        s.lower_bound(make_pair(a[i].first.second, -1));
    if (it == s.end()) {
      puts("NO");
      return 0;
    } else {
      ans[a[i].second] = it->second + 1;
      --cnt[it->second];
      if (cnt[it->second] == 0) {
        s.erase(it);
      }
    }
  }
  puts("YES");
  for (int i = 0; i < n; ++i) {
    printf("%d ", ans[i]);
  }
  return 0;
}
