#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
using ll = long long;
const ll mod = 1e9 + 7;
const int maxn = 1e6 + 5;
int n;
vector<array<int, 3>> part;
int ans[maxn];
int m;
vector<array<int, 4>> actor;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  part.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> part[i][0] >> part[i][1];
    part[i][2] = i;
  }
  sort(part.begin(), part.end());
  cin >> m;
  actor.resize(m);
  for (int i = 0; i < m; i++) {
    cin >> actor[i][0] >> actor[i][1] >> actor[i][2];
    actor[i][3] = i;
  }
  sort(actor.begin(), actor.end());
  int j = 0;
  set<array<int, 3>> act;
  for (auto p : part) {
    int l = p[0];
    int r = p[1];
    int id = p[2];
    while (!act.empty() && (*act.begin())[0] < l) {
      act.erase(act.begin());
    }
    while (j < m && actor[j][0] <= l) {
      act.insert({actor[j][1], actor[j][2], actor[j][3]});
      j++;
    }
    if (act.empty()) out("NO");
    auto iter = act.lower_bound({r, -1, -1});
    if (iter == act.end()) out("NO");
    auto cur = *iter;
    act.erase(iter);
    ans[id] = cur[2];
    cur[1]--;
    if (cur[1] > 0) {
      act.insert(cur);
    }
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) {
    cout << ans[i] + 1 << " ";
  }
  cout << endl;
  return 0;
}
