#include <bits/stdc++.h>
using namespace std;
struct T {
  int left, right, number, index;
  T() {}
  T(int left, int right, int index, int number = 0)
      : left(left), right(right), index(index), number(number) {}
  bool operator<(const T &other) const { return right < other.right; }
};
bool comp2(const T &first, const T &second) { return first.left < second.left; }
bool comp3(const T &first, const T &second) {
  return first.index < second.index;
}
int main() {
  int n, m;
  cin >> n;
  vector<T> song;
  for (int index = 0; index < n; ++index) {
    int left, right;
    cin >> left >> right;
    song.push_back(T(left, right, index));
  }
  sort(song.begin(), song.end(), comp2);
  cin >> m;
  vector<T> actor;
  for (int index = 0; index < m; ++index) {
    int left, right, number;
    cin >> left >> right >> number;
    actor.push_back(T(left, right, index, number));
  }
  sort(actor.begin(), actor.end(), comp2);
  int j = 0;
  multiset<T> st;
  for (int i = 0; i < n; ++i) {
    while (j < m && actor[j].left <= song[i].left) {
      st.insert(actor[j]);
      ++j;
    }
    multiset<T>::iterator t = st.lower_bound(T(song[i].left, song[i].right, 0));
    if (t == st.end() ||
        !(t->left <= song[i].left && t->right >= song[i].right)) {
      cout << "NO" << endl;
      return 0;
    }
    auto tmp = *t;
    st.erase(t);
    song[i].number = tmp.index;
    --tmp.number;
    if (tmp.number > 0) {
      st.insert(tmp);
    }
  }
  sort(song.begin(), song.end(), comp3);
  cout << "YES" << endl;
  for (int i = 0; i < n; ++i) cout << song[i].number + 1 << ' ';
}
