#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
tuple<int, int, int> song[MAX];
tuple<int, int, int, int> actor[MAX];
int ans[MAX];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> get<0>(song[i]) >> get<1>(song[i]);
    get<2>(song[i]) = i;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> get<0>(actor[i]) >> get<1>(actor[i]) >> get<2>(actor[i]);
    get<3>(actor[i]) = i;
  }
  sort(song, song + n);
  sort(actor, actor + m);
  map<tuple<int, int>, int> mp;
  auto cur = 0;
  for (int i = 0; i < n; i++) {
    auto s = get<0>(song[i]);
    while (cur < m && get<0>(actor[cur]) <= s) {
      mp[make_tuple(get<1>(actor[cur]), get<3>(actor[cur]))] +=
          get<2>(actor[cur]);
      cur++;
    }
    auto it = mp.lower_bound(make_tuple(get<1>(song[i]), 0));
    if (it == mp.end()) {
      cout << "NO";
      return 0;
    }
    ans[get<2>(song[i])] = get<1>(it->first);
    it->second--;
    if (it->second == 0) mp.erase(it);
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) cout << ans[i] + 1 << " ";
  return 0;
}
