#include <bits/stdc++.h>
struct song {
  size_t l, h;
  size_t id;
};
bool operator<(const song& lhs, const song& rhs) { return lhs.l < rhs.l; }
std::istream& operator>>(std::istream& is, song& s) { return is >> s.l >> s.h; }
struct actor {
  size_t l, h, k;
  size_t id;
};
bool operator<(const actor& lhs, const actor& rhs) { return lhs.l < rhs.l; }
std::istream& operator>>(std::istream& is, actor& a) {
  return is >> a.l >> a.h >> a.k;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  size_t n;
  std::cin >> n;
  std::vector<song> songs(n);
  for (size_t i = 0; i < n; ++i) {
    std::cin >> songs[i];
    songs[i].id = i;
  }
  std::sort(songs.begin(), songs.end());
  size_t m;
  std::cin >> m;
  std::vector<actor> actors(m);
  for (size_t i = 0; i < m; ++i) {
    std::cin >> actors[i];
    actors[i].id = i;
  }
  std::sort(actors.begin(), actors.end());
  bool ok = true;
  std::vector<size_t> result(n);
  std::multimap<size_t, actor> avail;
  size_t ptr = 0;
  for (const auto& s : songs) {
    while (ptr < m && actors[ptr].l <= s.l) {
      avail.emplace(actors[ptr].h, actors[ptr]);
      ptr += 1;
    }
    auto it = avail.lower_bound(s.h);
    if (it == avail.end()) {
      ok = false;
      break;
    }
    result[s.id] = it->second.id;
    it->second.k -= 1;
    if (it->second.k == 0) {
      avail.erase(it);
    }
  }
  if (!ok) {
    std::cout << "NO\n";
    return 0;
  }
  std::cout << "YES\n";
  for (size_t x : result) {
    std::cout << x + 1 << ' ';
  }
  std::cout << '\n';
}
