#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T, typename T1>
T amax(T& a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T& a, T1 b) {
  if (b < a) a = b;
  return a;
}
const long long INF = 1e18;
const int32_t M = 1e9 + 7;
const int32_t MM = 998244353;
const long long N = 1e5 + 5;
struct part {
  long long a, b, id;
  bool operator<(const part& other) const {
    return tie(a, id) < tie(other.a, other.id);
  }
} p[N];
struct singer {
  long long c, d, k, id;
  bool operator<(const singer& other) const {
    return tie(d, id) < tie(other.d, other.id);
  }
} s[N];
istream& operator>>(istream& in, singer& s) {
  in >> s.c >> s.d >> s.k;
  return in;
}
istream& operator>>(istream& in, part& p) {
  in >> p.a >> p.b;
  return in;
}
set<part> parts;
long long assignment[N];
void solve() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> p[i];
    p[i].id = i + 1;
  }
  sort(p, p + n, [&](part a, part b) { return a.b < b.b; });
  long long m;
  cin >> m;
  for (long long i = 0; i < m; i++) {
    cin >> s[i];
    s[i].id = i + 1;
  }
  sort(s, s + m);
  long long i = 0, j = 0;
  while (i < m) {
    if (j < n && p[j].b <= s[i].d) {
      parts.insert(p[j++]);
      continue;
    }
    auto it = parts.lower_bound({s[i].c, 0, -1});
    if (it != parts.end()) {
      assignment[it->id] = s[i].id;
      s[i].k--;
      parts.erase(it);
    } else {
      i++;
      continue;
    }
    if (s[i].k == 0) i++;
  }
  if (j < n || (long long)((parts).size())) {
    cout << "NO";
    return;
  }
  cout << "YES\n";
  for (long long i = 1; i < n + 1; i++) {
    cout << assignment[i] << " ";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
