#include <bits/stdc++.h>
using namespace std;
const int INF = numeric_limits<int>::max();
const int MINF = numeric_limits<int>::min();
const int INFF = (INF / 2 - 1);
const int EPS = 1e-9;
const int dy[] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int dx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int pi = 3.1415926535897932384626;
struct Entry {
  int type;
  int lower, higher;
  int k;
  int idx;
  Entry(int _t, int _l, int _h, int _idx)
      : type(_t), lower(_l), higher(_h), idx(_idx) {}
  Entry(int _t, int _l, int _h, int _k, int _idx)
      : type(_t), lower(_l), higher(_h), k(_k), idx(_idx) {}
};
bool operator<(const Entry a, const Entry b) {
  if (a.lower < b.lower) {
    return true;
  } else if (a.lower == b.lower) {
    if (a.type < b.type)
      return true;
    else if (a.type == b.type) {
      return a.higher < b.higher;
    }
  }
  return false;
}
struct Comparator {
  bool operator()(const Entry lhs, const Entry rhs) {
    if (lhs.higher < rhs.higher) {
      return true;
    } else if (lhs.higher == rhs.higher) {
      if (lhs.type > rhs.type)
        return true;
      else if (lhs.type == rhs.type) {
        return lhs.idx < rhs.idx;
      }
    }
    return false;
  }
};
vector<Entry> q;
set<Entry, Comparator> s;
int ans[100000];
int main() {
  int(n);
  scanf("%d", &(n));
  for (int i = 1; i <= n; i++) {
    int(a), (b);
    scanf("%d%d", &(a), &(b));
    q.push_back(Entry(1, a, b, i));
  }
  int(m);
  scanf("%d", &(m));
  for (int i = 1; i <= m; i++) {
    int(c), (d), (k);
    scanf("%d%d%d", &(c), &(d), &(k));
    q.push_back(Entry(0, c, d, k, i));
  }
  sort(q.begin(), q.end());
  for (int i = 0; i < (int)q.size(); i++) {
    Entry& entry = q[i];
    if (entry.type == 0) {
      s.insert(entry);
    } else {
      set<Entry, Comparator>::iterator it = s.lower_bound(entry);
      if (it == s.end()) {
        puts("NO");
        return 0;
      }
      Entry actor = *it;
      s.erase(it);
      ans[entry.idx] = actor.idx;
      actor.k--;
      if (actor.k > 0) s.insert(actor);
    }
  }
  puts("YES");
  for (int i = 1; i <= n; i++) {
    printf("%d ", ans[i]);
  }
  putchar('\n');
  return 0;
}
