#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int w = 0, x = 0;
  char c = getchar();
  while (!isdigit(c)) w |= c == '-', c = getchar();
  while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
  return w ? -x : x;
}
namespace star {
const int maxn = 1e5 + 10;
struct music {
  int l, r, k, id;
  inline bool operator<(const music &zp) const { return r < zp.r; }
} a[maxn], b[maxn];
struct cmp {
  bool operator()(music a, music b) { return a.l < b.l; }
};
int n, m, ans[maxn];
multiset<music, cmp> q;
inline void work() {
  n = read();
  for (int i = 1; i <= n; i++) a[i].l = read(), a[i].r = read(), a[i].id = i;
  m = read();
  for (int i = 1; i <= m; i++)
    b[i].l = read(), b[i].r = read(), b[i].k = read(), b[i].id = i;
  sort(a + 1, a + 1 + n), sort(b + 1, b + 1 + m);
  int j = 1;
  for (int i = 1; i <= m; i++) {
    while (j <= n and a[j].r <= b[i].r) q.insert(a[j++]);
    while (b[i].k--) {
      multiset<music, cmp>::iterator it = q.lower_bound(b[i]);
      if (it == q.end()) break;
      ans[(*it).id] = b[i].id;
      q.erase(it);
    }
  }
  if (!q.empty() or j != n + 1) return (void)puts("NO");
  puts("YES");
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
}
}  // namespace star
signed main() {
  star::work();
  return 0;
}
