#include <bits/stdc++.h>
using namespace std;
long long int n, m;
vector<pair<pair<long long int, long long int>,
            pair<long long int, long long int>>>
    a;
vector<long long int> ans(200005);
struct cmp {
  bool operator()(pair<pair<long long int, long long int>,
                       pair<long long int, long long int>>
                      a,
                  pair<pair<long long int, long long int>,
                       pair<long long int, long long int>>
                      b) const {
    return a.first.second < b.first.second;
  }
};
bool cmp1(
    pair<pair<long long int, long long int>, pair<long long int, long long int>>
        a,
    pair<pair<long long int, long long int>, pair<long long int, long long int>>
        b) {
  if (a.first.first == b.first.first) return a.second.first > b.second.first;
  return a.first.first < b.first.first;
}
multiset<pair<pair<long long int, long long int>,
              pair<long long int, long long int>>,
         cmp>
    actors;
long long powmod(long long x, long long y, long long m) {
  long long res = 1LL;
  while (y) {
    if (y & 1) res = (res * x) % m;
    x = (x * x) % m;
    y /= 2;
  }
  return res;
}
bool cmp(
    pair<pair<long long int, long long int>, pair<long long int, long long int>>
        a,
    pair<pair<long long int, long long int>, pair<long long int, long long int>>
        b) {
  if (a.first.second - a.first.first + 1 == b.first.second - b.first.first + 1)
    return a < b;
  return a.first.second - a.first.first + 1 <
         b.first.second - b.first.first + 1;
}
bool sat(pair<long long int, long long int> a,
         pair<long long int, long long int> b) {
  if (a.first <= b.first && b.second <= a.second) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    long long int x, y;
    cin >> x >> y;
    a.push_back(make_pair(make_pair(x, y), make_pair(0, i)));
  }
  cin >> m;
  for (long long int i = 1; i <= m; i++) {
    long long int x, y, z;
    cin >> x >> y >> z;
    a.push_back(make_pair(make_pair(x, y), make_pair(z, i)));
  }
  sort(a.begin(), a.end(), cmp1);
  long long int poss = 1;
  for (auto x : a) {
    if (x.second.first == 0) {
      auto itr = actors.lower_bound(x);
      if (itr == actors.end()) {
        poss = 0;
        break;
      }
      auto temp = *itr;
      if (x.first.second <= temp.first.second) {
        ans[x.second.second] = temp.second.second;
        temp.second.first--;
        actors.erase(itr);
        if (temp.second.first) actors.insert(temp);
      }
    } else {
      actors.insert(x);
    }
  }
  if (poss == 0) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  for (long long int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << "\n";
}
