#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (1) {
    a = a % b;
    if (a == 0) return b;
    b = b % a;
    if (b == 0) return a;
  }
}
const int inf = 1e9;
set<pair<pair<int, int>, int> > part;
set<pair<int, int> > ac;
vector<pair<pair<int, int>, int> > acu;
int k[1000 * 1000];
int match[1000 * 1000];
int main() {
  int n, m, a, b, c;
  cin >> n;
  memset(k, 0, sizeof k);
  memset(match, -1, sizeof match);
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    part.insert(make_pair(make_pair(a, b), i));
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> a >> b >> c;
    acu.push_back(make_pair(make_pair(a, b), i));
    k[i] = c;
  }
  sort(acu.begin(), acu.end());
  ac.insert(make_pair(inf, -1));
  int s = 0, lo = 0;
  for (int i = 0; i < n; i++) {
    a = part.begin()->first.first;
    b = part.begin()->first.second;
    c = part.begin()->second;
    part.erase(part.begin());
    s = a;
    while (lo < m && acu[lo].first.first <= s) {
      ac.insert(make_pair(acu[lo].first.second, acu[lo].second));
      lo++;
    }
    int x = (ac.upper_bound(make_pair(b - 0.1, inf)))->first;
    int y = (ac.upper_bound(make_pair(b - 0.1, inf)))->second;
    if (y != -1 && x >= b) {
      k[y]--;
      match[c] = y;
      if (k[y] == 0) {
        ac.erase(ac.upper_bound(make_pair(b - 0.1, inf)));
      }
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) {
    if (i > 0) cout << " ";
    cout << match[i] + 1;
  }
  cout << endl;
  return 0;
}
