#include <bits/stdc++.h>
using namespace std;
ifstream fin("A.in");
struct actor {
  int a, b, k;
} v[100010];
struct show {
  int a, b;
} s[100010];
struct event {
  int i, x, t;
};
vector<event> e;
set<pair<int, int> > S;
int n, m, sol[100010];
bool cmp2(const event &a, const event &b) {
  if (a.x == b.x) {
    return a.t < b.t;
  }
  return a.x < b.x;
}
event make_event(int i, int x, int t) {
  event E;
  E.i = i;
  E.x = x;
  E.t = t;
  return E;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> s[i].a >> s[i].b;
  }
  cin >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> v[i].a >> v[i].b >> v[i].k;
  }
  for (int i = 1; i <= n; ++i) {
    e.push_back(make_event(i, s[i].a, 2));
  }
  for (int i = 1; i <= m; ++i) {
    e.push_back(make_event(i, v[i].a, 1));
    e.push_back(make_event(i, v[i].b, 3));
  }
  sort(e.begin(), e.end(), cmp2);
  for (int i = 0; i < e.size(); ++i) {
    if (e[i].t == 1) {
      int x = e[i].i;
      S.insert(make_pair(v[x].b, x));
    } else if (e[i].t == 3) {
      int x = e[i].i;
      if (S.find(make_pair(v[x].b, x)) != S.end())
        S.erase(make_pair(v[x].b, x));
    } else if (e[i].t == 2) {
      int x = e[i].i;
      set<pair<int, int> >::iterator it = S.lower_bound(make_pair(s[x].b, 0));
      if (it == S.end()) {
        cout << "NO";
        return 0;
      }
      int y = it->second;
      sol[x] = y;
      v[y].k--;
      if (v[y].k == 0) S.erase(make_pair(v[y].b, y));
    }
  }
  cout << "YES\n";
  for (int i = 1; i <= n; ++i) {
    cout << sol[i] << " ";
  }
}
