#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
long long add(long long a, long long b) {
  long long ret = a + b;
  if (ret >= 1000000007) ret -= 1000000007;
  return ret;
}
long long subtract(long long a, long long b) {
  long long ret = a - b;
  if (ret < 0) ret += 1000000007;
  return ret;
}
long long mult(long long a, long long b) {
  long long ret = a * b;
  if (ret >= 1000000007) ret %= 1000000007;
  return ret;
}
long long bigmod(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = mult(ret, a);
    b >>= 1;
    a = mult(a, a);
  }
  return ret;
}
long long inverse(long long n) { return bigmod(n, 1000000007 - 2); }
bool base[1000010];
vector<int> primes;
void sieve(int mx) {
  mx += 10;
  int x = sqrt(mx);
  for (int i = 3; i <= x; i += 2)
    if (base[i] == 0)
      for (int j = i * i, k = i << 1; j < mx; j += k) base[j] = 1;
  primes.push_back(2);
  for (int i = 3; i < mx; i += 2)
    if (base[i] == 0) primes.push_back(i);
}
bool checkBit(int n, int i) { return (n & (1 << i)); }
int setBit(int n, int i) { return (n | (1 << i)); }
int resetBit(int n, int i) { return (n & (~(1 << i))); }
int ans[100010], rem[100010];
struct data {
  long long l, r, t, k;
} a[200010];
bool cmp(data &x, data &y) {
  if (x.l == y.l) {
    if (x.t == y.t) return x.r < y.r;
    return x.t > y.t;
  }
  return x.l < y.l;
}
set<pair<long long, pair<long long, long long> > > s;
int main() {
  int n, m, tot = 0;
  long long l, r, k;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%lld%lld", &l, &r);
    a[tot].l = l, a[tot].r = r, a[tot].t = -1, a[tot].k = i;
    ++tot;
  }
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    scanf("%lld%lld%lld", &l, &r, &k);
    a[tot].l = l, a[tot].r = r, a[tot].t = i, a[tot].k = k;
    rem[i] = k;
    ++tot;
  }
  sort(a, a + tot, cmp);
  for (int i = 0; i < tot; ++i) {
    if (a[i].t != -1)
      s.insert({a[i].r, {a[i].k, a[i].t}});
    else {
      auto it = s.lower_bound({a[i].r, {-1, -1}});
      if (it == s.end()) {
        puts("NO");
        return 0;
      }
      pair<long long, pair<long long, long long> > nw = *it;
      ans[a[i].k] = nw.second.second;
      --rem[nw.second.second];
      if (rem[nw.second.second] == 0) s.erase(it);
    }
  }
  puts("YES");
  for (int i = 0; i < n; ++i) printf("%d ", ans[i] + 1);
  puts("");
  return 0;
}
