#include <bits/stdc++.h>
using namespace std;
const int M = 1000000000;
struct point {
  int x, y, id, k;
  bool operator<(const point &p) const {
    if (x == p.x) {
      if (y == p.y) {
        return k < p.k;
      }
      return y < p.y;
    }
    return x < p.x;
  }
};
int main(void) {
  int n;
  scanf("%d", &n);
  vector<point> P;
  for (int i = 0; i < (n); ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    x = M - x;
    P.push_back(point{x, y, i, -1});
  }
  int m;
  scanf("%d", &m);
  for (int i = 0; i < (m); ++i) {
    int x, y, k;
    scanf("%d%d%d", &x, &y, &k);
    x = M - x;
    P.push_back(point{x, y, i + 1, k});
  }
  sort((P).begin(), (P).end());
  set<pair<int, int> > S;
  vector<int> res(n);
  for (const point &p : P) {
    if (p.k == -1) {
      S.insert({p.y, p.id});
    } else {
      for (int i = 0; i < p.k; ++i) {
        auto it = S.lower_bound({p.y + 1, -1});
        if (it == S.begin()) {
          break;
        }
        --it;
        res[it->second] = p.id;
        S.erase(it);
      }
    }
  }
  if (!S.empty()) {
    puts("NO");
  } else {
    puts("YES");
    for (int i = 0; i < (n); ++i) {
      printf("%d ", res[i]);
    }
    puts("");
  }
  return 0;
}
