#include <bits/stdc++.h>
using namespace std;
template <class T>
T nextInt() {
  T x = 0, p = 1;
  char c;
  do {
    c = getchar();
  } while (c <= 32);
  if (c == '-') {
    p = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * p;
}
double nextDouble() {
  double x;
  scanf("%lf", &x);
  return x;
}
const int maxn = 4 * 100500;
struct seg {
  int l, r, idx;
  seg() {}
  seg(int l, int r, int idx) : l(l), r(r), idx(idx) {}
  bool operator<(const seg& B) const { return l > B.l; }
};
struct man {
  int l, r, c, idx;
  man() {}
  man(int l, int r, int c, int idx) : l(l), r(r), c(c), idx(idx) {}
  bool operator<(const man& B) const { return l > B.l; }
};
int n, m, l[maxn], r[maxn], c[maxn], d[maxn], k[maxn];
priority_queue<seg> jobs;
priority_queue<man> mans;
vector<int> v;
vector<pair<int, int> > idxs[maxn];
long long ft[maxn];
int answer[maxn];
void addFT(int r, long long val) {
  while (r < maxn) {
    ft[r] += val;
    r |= r + 1;
  }
}
long long sumFT(int r) {
  long long res = 0;
  while (r >= 0) {
    res += ft[r];
    r = (r & (r + 1)) - 1;
  }
  return res;
}
long long sumFT(int l, int r) { return sumFT(r) - sumFT(l - 1); }
int findInV(int x) { return lower_bound(v.begin(), v.end(), x) - v.begin(); }
void BAD() {
  cout << "NO\n";
  exit(0);
}
void deleteJob(seg t, int r) {
  addFT(r, -1);
  answer[t.idx] = idxs[r].back().second;
  idxs[r].back().first--;
  if (idxs[r].back().first == 0) idxs[r].pop_back();
}
void findJob(seg t) {
  int l = t.r - 1, r = maxn;
  while (r - l > 1) {
    int mid = (l + r + 1) >> 1;
    if (sumFT(t.r, mid))
      r = mid;
    else
      l = mid;
  }
  if (r == maxn) BAD();
  deleteJob(t, r);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    v.push_back(l[i]);
    v.push_back(r[i]);
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> c[i] >> d[i] >> k[i];
    v.push_back(c[i]);
    v.push_back(d[i]);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  for (int i = 1; i <= n; i++) {
    l[i] = findInV(l[i]);
    r[i] = findInV(r[i]);
  }
  for (int i = 1; i <= m; i++) {
    c[i] = findInV(c[i]);
    d[i] = findInV(d[i]);
  }
  for (int i = 1; i <= n; i++) {
    jobs.push(seg(l[i], r[i], i));
  }
  for (int i = 1; i <= m; i++) {
    mans.push(man(c[i], d[i], k[i], i));
  }
  while (!jobs.empty()) {
    int x = jobs.top().l;
    while (!mans.empty() && mans.top().l <= x) {
      addFT(mans.top().r, mans.top().c);
      idxs[mans.top().r].push_back(make_pair(mans.top().c, mans.top().idx));
      mans.pop();
    }
    while (!jobs.empty() && jobs.top().l == x) {
      findJob(jobs.top());
      jobs.pop();
    }
  }
  cout << "YES\n";
  for (int i = 1; i <= n; i++) cout << answer[i] << " ";
  cout << "\n";
  return 0;
}
