#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct node {
  int d, k, id;
  bool operator<(const node& tmp) const { return d < tmp.d; }
};
multiset<node> st;
multiset<node>::iterator it;
struct node1 {
  int a, b, id;
  bool operator<(const node1& rhy) const { return a < rhy.a; }
} a[N];
struct node2 {
  int c, d, k, id;
  bool operator<(const node2& rhy) const { return c < rhy.c; }
} b[N];
int ans[N];
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d%d", &a[i].a, &a[i].b), a[i].id = i;
  scanf("%d", &m);
  for (int i = 0; i < m; ++i)
    scanf("%d%d%d", &b[i].c, &b[i].d, &b[i].k), b[i].id = i;
  sort(a, a + n);
  sort(b, b + m);
  int j = 0, flag = 0;
  for (int i = 0; i < n; ++i) {
    node tmp;
    while (j < m && b[j].c <= a[i].a) {
      tmp.d = b[j].d, tmp.k = b[j].k, tmp.id = b[j].id;
      st.insert(tmp);
      j++;
    }
    if (st.empty()) {
      flag = 1;
      break;
    }
    tmp.d = a[i].b, tmp.k = 0, tmp.id = 0;
    it = st.lower_bound(tmp);
    if (it == st.end()) {
      flag = 1;
      break;
    }
    tmp = *it;
    st.erase(it);
    ans[a[i].id] = tmp.id;
    if (tmp.k > 1) tmp.k--, st.insert(tmp);
  }
  if (flag == 1)
    printf("NO\n");
  else {
    puts("YES");
    for (int i = 0; i < n; ++i) printf("%d ", ans[i] + 1);
    puts("");
  }
  return 0;
}
