#include <bits/stdc++.h>
using namespace std;
struct Song {
  int id, first, second;
};
bool cmp(const Song &a, const Song &b) { return a.second < b.second; }
struct Actor {
  int id;
  int a, b, k;
} actors[111111];
bool acmp(const Actor &a, const Actor &b) { return a.b < b.b; }
int main() {
  int n;
  cin >> n;
  Song ranges[111111];
  for (int i = 0; i < n; i++) {
    cin >> ranges[i].first >> ranges[i].second;
    ranges[i].id = i;
  }
  sort(ranges, ranges + n, cmp);
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> actors[i].a >> actors[i].b >> actors[i].k;
    actors[i].id = i + 1;
  }
  sort(actors, actors + m, acmp);
  int j = 0;
  int ans[111111];
  memset(ans, -1, sizeof(ans));
  int now = 0;
  set<pair<int, int> > toMatch;
  for (int i = 0; i < m; i++) {
    while (now < n && actors[i].b >= ranges[now].second) {
      toMatch.insert(make_pair(ranges[now].first, now));
      now++;
    }
    set<pair<int, int> >::iterator s, p;
    s = p = toMatch.lower_bound(make_pair(actors[i].a, -1));
    for (; p != toMatch.end() && actors[i].k > 0; p++) {
      pair<int, int> song = *p;
      if (actors[i].a <= song.first) {
        ans[ranges[song.second].id] = actors[i].id;
        actors[i].k--;
      }
    }
    toMatch.erase(s, p);
  }
  if (toMatch.size() > 0 || now < n)
    cout << "NO" << endl;
  else {
    cout << "YES" << endl;
    bool first = true;
    for (int i = 0; i < n; i++) {
      if (first)
        first = false;
      else
        cout << " ";
      cout << ans[i];
    }
    cout << endl;
  }
  return 0;
}
