#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long maxn = 2e5 + 5;
struct range {
  long long a, b, c, id;
  range(long long A, long long B, long long C, long long ID) {
    a = A;
    b = B;
    c = C;
    id = ID;
  }
};
bool compare(const range &i, const range &j) {
  if (i.a < j.a) return 1;
  if (i.a == j.a) return i.c < j.c;
  return 0;
}
long long ans[maxn];
void finish() {
  cout << "NO" << '\n';
  ;
  exit(0);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  long long a[n + 1], b[n + 1];
  set<pair<long long, long long> > s;
  vector<range> v;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i] >> b[i];
    v.emplace_back(range(a[i], b[i], 1, i));
  }
  long long m;
  cin >> m;
  long long c[m + 1], d[m + 1], k[m + 1];
  for (long long i = 1; i <= m; ++i) {
    cin >> c[i] >> d[i] >> k[i];
    v.emplace_back(range(c[i], d[i], 0, i));
  }
  sort(v.begin(), v.end(), compare);
  for (const auto &it : v) {
    if (it.c == 0) {
      s.insert({d[it.id], it.id});
    } else {
      auto j = s.lower_bound({b[it.id], -1});
      if (j == s.end()) finish();
      long long id = (*j).second;
      ans[it.id] = id;
      k[id]--;
      if (k[id] == 0) s.erase(j);
    }
  }
  cout << "YES" << '\n';
  ;
  for (long long i = 1; i <= n; ++i) {
    cout << ans[i] << " ";
  }
  cout << '\n';
  ;
  return 0;
}
