#include <bits/stdc++.h>
using namespace std;
int n, m;
class stage {
 public:
  int l, r, id;
  bool operator<(const stage &t) const { return l == t.l ? r < t.r : l < t.l; }
} a[100010];
set<pair<int, int> > st;
class actor {
 public:
  int l, r, k, id;
  bool operator<(const actor &t) const { return l == t.l ? r < t.r : l < t.l; }
} c[100010];
int ans[100010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].l, &a[i].r);
    a[i].id = i;
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d%d", &c[i].l, &c[i].r, &c[i].k);
    c[i].id = i;
  }
  sort(a + 1, a + n + 1);
  sort(c + 1, c + m + 1);
  for (int i = 1, j = 1; i <= n; i++) {
    while (j <= m && c[j].l <= a[i].l) {
      st.insert(make_pair(c[j].r, j));
      j++;
    }
    set<pair<int, int> >::iterator it = st.lower_bound(make_pair(a[i].r, 0));
    if (it == st.end()) {
      puts("NO");
      return 0;
    }
    ans[a[i].id] = c[it->second].id;
    c[it->second].k--;
    if (!c[it->second].k) st.erase(it);
  }
  puts("YES");
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
