#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, i, cnt[N], ans[N], r, m;
pair<pair<long long, long long>, int> a[N], b[N];
set<pair<long long, long long> > second;
set<pair<long long, long long> >::iterator IT;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].first.first, &a[i].first.second);
    a[i].second = i;
  }
  sort(a + 1, a + n + 1);
  scanf("%d", &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &b[i].first.first, &b[i].first.second);
    scanf("%d", &cnt[i]);
    b[i].second = i;
  }
  sort(b + 1, b + m + 1);
  r = 1;
  for (i = 1; i <= n; i++) {
    while (r <= m && a[i].first.first >= b[r].first.first) {
      second.insert(make_pair(b[r].first.second, b[r].second));
      r++;
    }
    IT = second.lower_bound(make_pair(a[i].first.second, 0));
    if (IT == second.end()) {
      cout << "NO" << endl;
      return 0;
    }
    ans[a[i].second] = (*IT).second;
    cnt[(*IT).second]--;
    if (!cnt[(*IT).second]) second.erase(IT);
  }
  cout << "YES" << endl;
  for (i = 1; i <= n; i++) printf("%d ", ans[i]);
  printf("\n");
  return 0;
}
