#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int maxm = 4e5 + 10;
int n, m;
struct Node {
  int l, r, index;
  bool operator<(const Node &p) const { return l < p.l; }
} node[maxn];
struct Person {
  int l, r, k, index;
  bool operator<(const Person &p) const { return l < p.l; }
} person[maxn];
long long dp[maxm];
void add(int x, int y) {
  while (x < maxm) {
    dp[x] += (long long)y;
    x += x & -x;
  }
}
long long sum(int x) {
  long long res = 0;
  while (x > 0) {
    res += dp[x];
    x -= x & -x;
  }
  return res;
}
vector<int> vec;
queue<pair<int, int> > que[maxm];
int ans[maxn];
void init() {
  for (int i = 1; i <= n; i++)
    vec.push_back(node[i].l), vec.push_back(node[i].r);
  for (int i = 1; i <= m; i++)
    vec.push_back(person[i].l), vec.push_back(person[i].r);
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  for (int i = 1; i <= n; i++) {
    node[i].l =
        lower_bound(vec.begin(), vec.end(), node[i].l) - vec.begin() + 1;
    node[i].r =
        lower_bound(vec.begin(), vec.end(), node[i].r) - vec.begin() + 1;
  }
  for (int i = 1; i <= m; i++) {
    person[i].l =
        lower_bound(vec.begin(), vec.end(), person[i].l) - vec.begin() + 1;
    person[i].r =
        lower_bound(vec.begin(), vec.end(), person[i].r) - vec.begin() + 1;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &node[i].l, &node[i].r);
  for (int i = 1; i <= n; i++) node[i].index = i;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++)
    scanf("%d%d%d", &person[i].l, &person[i].r, &person[i].k);
  for (int i = 1; i <= m; i++) person[i].index = i;
  init();
  sort(node + 1, node + 1 + n);
  sort(person + 1, person + 1 + m);
  int lb, ub, mid, bns;
  int from = 0;
  pair<int, int> p;
  int u, v;
  int f = 1;
  for (int i = 1; i <= n; i++) {
    while (from < m && person[from + 1].l <= node[i].l) {
      from++;
      add(person[from].r, person[from].k);
      que[person[from].r].push(
          pair<int, int>(person[from].k, person[from].index));
    }
    lb = node[i].r;
    ub = maxm - 1;
    bns = -1;
    while (ub >= lb) {
      mid = (ub + lb) / 2;
      if (sum(mid) - sum(node[i].r - 1) > 0) {
        bns = mid;
        ub = mid - 1;
      } else
        lb = mid + 1;
    }
    if (bns == -1) {
      f = 0;
      break;
    }
    p = que[bns].front();
    que[bns].pop();
    u = p.first;
    v = p.second;
    ans[node[i].index] = p.second;
    if (p.first > 1) {
      que[bns].push(pair<int, int>(p.first - 1, p.second));
    }
    add(bns, -1);
  }
  if (f) {
    printf("YES\n");
    for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  } else
    printf("NO");
  return 0;
}
