#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline string tostr(const T &x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
inline long long parse(const string &s) {
  stringstream ss(s);
  long long x;
  ss >> x;
  return x;
}
const double EPS = 1e-9;
const int inf = 1000 * 1000 * 1000;
const char cinf = 102;
const long long linf = inf * 1ll * inf;
const double DINF = 1e200;
const double PI = 3.1415926535897932384626433832795l;
int gcd(int a, int b) { return a ? gcd(b % a, a) : b; }
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
long long powmod(long long a, long long p, long long m) {
  long long r = 1;
  while (p) {
    if (p & 1) r = r * a % m;
    p >>= 1;
    a = a * a % m;
  }
  return r;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  struct event {
    long long a, b, k;
    int id;
    bool dude;
    bool operator<(const event &e) const {
      return make_pair(a, !dude) < make_pair(e.a, !e.dude);
    }
  };
  vector<event> evs;
  int n;
  cin >> n;
  for (int i = 0; i < (n); ++i) {
    event e;
    cin >> e.a >> e.b;
    e.id = i;
    e.dude = false;
    evs.push_back(e);
  }
  int m;
  cin >> m;
  for (int i = 0; i < (m); ++i) {
    event e;
    cin >> e.a >> e.b >> e.k;
    e.id = i;
    e.dude = true;
    evs.push_back(e);
  }
  sort((evs).begin(), (evs).end());
  map<long long, vector<pair<long long, long long>>> A;
  vector<int> ans(n);
  for (event e : evs) {
    if (e.dude) {
      A[e.b].push_back(make_pair(e.id, e.k));
      continue;
    }
    auto it = A.lower_bound(e.b);
    if (it == A.end()) {
      cout << "NO";
      return 0;
    }
    auto &v = it->second;
    assert(((int)(v).size()));
    assert(v.back().second);
    --v.back().second;
    ans[e.id] = v.back().first;
    if (!v.back().second) v.pop_back();
    if (!((int)(v).size())) A.erase(it);
  }
  cout << "YES\n";
  for (int i = 0; i < (((int)(ans).size())); ++i) {
    cout << ans[i] + 1 << ' ';
  }
  return 0;
}
