#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const long long infLL = 9000000000000000000;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
inline long long inl() {
  long long x;
  scanf("%I64d", &x);
  return x;
}
inline double ind() {
  double x;
  scanf("%lf", &x);
  return x;
}
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline bool isLeapYear(long long year) {
  return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
inline void normal(long long &a) {
  a %= 1000000007;
  (a < 0) && (a += 1000000007);
}
inline long long modMul(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a * b) % 1000000007;
}
inline long long modAdd(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a + b) % 1000000007;
}
inline long long modSub(long long a, long long b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long modPow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1;
  }
  return r;
}
inline long long modInverse(long long a) { return modPow(a, 1000000007 - 2); }
inline long long modDiv(long long a, long long b) {
  return modMul(a, modInverse(b));
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x, int n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0) {
    int y = power(x, n / 2);
    return y * y;
  } else
    return x * power(x, n - 1);
}
struct node {
  int l, r, ty, id;
  bool operator<(const node &b) const {
    if (r == b.r) {
      if (l == b.l) {
        return ty < b.ty;
      }
      return l > b.l;
    }
    return r < b.r;
  }
} a[200010];
set<pair<int, int> > st;
int val[100010], ans[100010];
int main() {
  int n = in();
  for (int i = 0; i < n; i++) {
    a[i].l = in();
    a[i].r = in();
    a[i].id = i + 1;
    a[i].ty = 0;
  }
  int m = in();
  for (int i = n; i < n + m; i++) {
    a[i].l = in();
    a[i].r = in();
    val[i - n + 1] = in();
    a[i].id = i - n + 1;
    a[i].ty = 1;
  }
  sort(a, a + n + m);
  int cnt = 0;
  for (int i = 0; i < n + m; i++) {
    if (a[i].ty) {
      auto it = st.lower_bound({a[i].l, 0});
      if (it == st.end()) continue;
      while (it != st.end() && val[a[i].id]--) {
        ans[it->second] = a[i].id;
        cnt++;
        st.erase(it++);
      }
    } else
      st.insert({a[i].l, a[i].id});
  }
  if (cnt != n) {
    printf("NO\n");
  } else {
    printf("YES\n");
    for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
    printf("\n");
  }
  return 0;
}
