#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T x, T y) {
  if (x > y) swap(x, y);
  while (x != 0) {
    T r = y % x;
    y = x;
    x = r;
  }
  return y;
}
template <class T>
int cntbit(T s) {
  return __builtin_popcountll(s);
}
const int Nmax = 100100;
struct node {
  int x, y, value, v;
} a[Nmax], b[Nmax];
int n, m, tg[Nmax], cnt, match[Nmax];
long long t[4 * Nmax];
vector<pair<int, int> > ad[Nmax];
void update(int i, int lo, int hi, int u, int x) {
  if (lo == hi) {
    t[i] += x;
    return;
  }
  int mid = (lo + hi) / 2;
  if (mid >= u)
    update(i * 2, lo, mid, u, x);
  else
    update(i * 2 + 1, mid + 1, hi, u, x);
  t[i] = t[i * 2] + t[i * 2 + 1];
}
long long get_sum(int i, int lo, int hi, int u, int v) {
  if (u <= lo && hi <= v) return t[i];
  if (u > hi || v < lo) return 0;
  int mid = (lo + hi) / 2;
  return get_sum(i * 2, lo, mid, u, v) + get_sum(i * 2 + 1, mid + 1, hi, u, v);
}
int get(int i, int lo, int hi, long long u) {
  if (lo == hi) return lo;
  int mid = (lo + hi) / 2;
  if (t[i * 2 + 1] >= u) return get(i * 2 + 1, mid + 1, hi, u);
  return get(i * 2, lo, mid, u - t[i * 2 + 1]);
}
int Find(int x) {
  if (x > cnt) return 0;
  long long sum = get_sum(1, 1, cnt, x, cnt);
  if (sum == 0) return 0;
  return get(1, 1, cnt, sum);
}
void Match(int i, int j) {
  match[i] = ad[j].back().first;
  ad[j].back().second--;
  if (ad[j].back().second == 0) ad[j].pop_back();
  update(1, 1, cnt, j, -1);
}
bool cmp(node a, node b) { return (a.x < b.x); }
void init() {
  cnt = 0;
  for (int i = 1; i <= m; i++) tg[i] = b[i].y;
  sort(tg + 1, tg + m + 1);
  for (int i = 1; i <= m; i++)
    if (i == 1 || tg[i] != tg[i - 1]) tg[++cnt] = tg[i];
  for (int i = 1; i <= n; i++)
    a[i].y = lower_bound(tg + 1, tg + cnt + 1, a[i].y) - tg;
  for (int i = 1; i <= m; i++)
    b[i].y = lower_bound(tg + 1, tg + cnt + 1, b[i].y) - tg;
  sort(a + 1, a + n + 1, cmp);
  sort(b + 1, b + m + 1, cmp);
}
void solve() {
  int res = 1, pos = 1;
  for (int i = 1; i <= n; i++) {
    while (pos <= m && b[pos].x <= a[i].x) {
      ad[b[pos].y].push_back(make_pair(b[pos].v, b[pos].value));
      update(1, 1, cnt, b[pos].y, b[pos].value);
      pos++;
    }
    int x = Find(a[i].y);
    if (x == 0) {
      res = 0;
      break;
    }
    Match(a[i].v, x);
  }
  if (res == 1) {
    cout << "YES" << endl;
    for (int i = 1; i <= n; i++) cout << match[i] << ' ';
  } else
    cout << "NO";
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x >> a[i].y;
    a[i].v = i;
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> b[i].x >> b[i].y >> b[i].value;
    b[i].v = i;
  }
  init();
  solve();
  return 0;
}
