#include <bits/stdc++.h>
using namespace std;
const int Max = 100001;
tuple<long long, long long, int> part[Max];
tuple<long long, long long, long long, int> act[Max];
int ans[Max];
int n, m;
map<pair<long long, int>, long long> mp;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i)
    cin >> get<0>(part[i]) >> get<1>(part[i]), get<2>(part[i]) = i;
  cin >> m;
  for (int i = 0; i < m; ++i)
    cin >> get<0>(act[i]) >> get<1>(act[i]) >> get<2>(act[i]),
        get<3>(act[i]) = i;
  sort(part, part + n);
  sort(act, act + m);
  int p = 0;
  for (int i = 0; i < n; ++i) {
    while (p < m && get<0>(act[p]) <= get<0>(part[i]))
      mp[make_pair(get<1>(act[p]), get<3>(act[p]))] += get<2>(act[p]), p++;
    auto it = mp.lower_bound(make_pair(get<1>(part[i]), 0));
    if (it == mp.end()) return puts("NO"), 0;
    ans[get<2>(part[i])] = it->first.second;
    if (!--it->second) mp.erase(it);
  }
  puts("YES");
  for (int i = 0; i < n; ++i) cout << ans[i] + 1 << ' ';
}
