#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool getmin(T *a, const T &b) {
  if (b < *a) {
    *a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool getmax(T *a, const T &b) {
  if (b > *a) {
    *a = b;
    return true;
  }
  return false;
}
template <class T>
inline void read(T *a) {
  char c;
  while (isspace(c = getchar())) {
  }
  bool flag = 0;
  if (c == '-')
    flag = 1, *a = 0;
  else
    *a = c - 48;
  while (isdigit(c = getchar())) *a = *a * 10 + c - 48;
  if (flag) *a = -*a;
}
const int mo = 1000000007;
template <class T>
T pow(T a, T b, int c = mo) {
  T res = 1;
  for (T i = 1; i <= b; i <<= 1, a = 1LL * a * a % c)
    if (b & i) res = 1LL * res * a % c;
  return res;
}
const int N = 100100;
pair<pair<int, int>, int> a[N];
pair<pair<int, int>, int> b[N];
int num[N];
int ans[N];
set<pair<int, int> > S;
int n, m;
int main() {
  cin >> n;
  for (int i = (1); i <= (n); ++i)
    read(&a[i].first.first), read(&a[i].first.second), a[i].second = i;
  sort(a + 1, a + n + 1);
  cin >> m;
  for (int i = (1); i <= (m); ++i)
    read(&b[i].first.first), read(&b[i].first.second), b[i].second = i,
                                                       read(num + i);
  sort(b + 1, b + m + 1);
  int j = 1;
  for (int i = (1); i <= (n); ++i) {
    while (j <= m && b[j].first.first <= a[i].first.first) {
      S.insert(std::make_pair(b[j].first.second, b[j].second));
      ++j;
    }
    set<pair<int, int> >::iterator it =
        S.lower_bound(std::make_pair(a[i].first.second, 0));
    if (it == S.end()) {
      cout << "NO" << endl;
      return 0;
    }
    pair<int, int> z = *it;
    ans[a[i].second] = z.second;
    if (!(--num[z.second])) S.erase(it);
  }
  cout << "YES" << endl;
  for (int i = (1); i <= (n); ++i) printf("%d ", ans[i]);
  cout << endl;
  return 0;
}
