#include <bits/stdc++.h>
using namespace std;
void output(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x == 0) {
    putchar('0');
    return;
  }
  int a[20], num = 0;
  while (x) a[++num] = x % 10, x /= 10;
  while (num > 0) putchar('0' + a[num--]);
}
inline long long myInt() {
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  int flag = 1;
  if (c == '-') flag = -1, c = getchar();
  long long x = 0;
  while (isdigit(c)) {
    x = (x * 10) + (c - '0');
    c = getchar();
  }
  if (flag == -1) return -x;
  return x;
}
const int INF = 1e9;
const int N = 400005;
struct node {
  int L, R, cnt;
  int id;
};
node p[N], q[N];
int n, m;
int b[N], bNum;
struct Node {
  int L, R, cnt, Min;
};
Node a[N << 2];
void build(int t, int L, int R) {
  a[t].L = L;
  a[t].R = R;
  a[t].cnt = 0;
  a[t].Min = INF;
  if (L == R) return;
  int M = (L + R) >> 1;
  build(t << 1, L, M);
  build(t << 1 | 1, M + 1, R);
}
int cmp(node a, node b) {
  if (a.L != b.L) return a.L < b.L;
  return a.R < b.R;
}
int ans[N];
struct NNode {
  int next, id, cnt;
};
NNode edges[N * 10];
int e;
int head[N];
void add(int id, int cnt, int y) {
  edges[e].id = id;
  edges[e].cnt = cnt;
  edges[e].next = head[y];
  head[y] = e++;
}
void pushUp(int t) {
  if (a[t].L == a[t].R) return;
  a[t].cnt = 0;
  a[t].Min = INF;
  if (a[t << 1].cnt != 0) {
    a[t].cnt += a[t << 1].cnt;
    a[t].Min = min(a[t].Min, a[t << 1].Min);
  }
  if (a[t << 1 | 1].cnt != 0) {
    a[t].cnt += a[t << 1 | 1].cnt;
    a[t].Min = min(a[t].Min, a[t << 1 | 1].Min);
  }
}
void insert(int t, int y, int cnt) {
  if (a[t].L == a[t].R) {
    a[t].cnt += cnt;
    if (a[t].cnt == 0)
      a[t].Min = INF;
    else
      a[t].Min = a[t].L;
    return;
  }
  int M = (a[t].L + a[t].R) >> 1;
  if (y <= M)
    insert(t << 1, y, cnt);
  else
    insert(t << 1 | 1, y, cnt);
  pushUp(t);
}
int get(int t, int y) {
  if (a[t].L >= y) {
    if (a[t].cnt == 0) return -1;
    return a[t].Min;
  }
  int M = (a[t].L + a[t].R) >> 1;
  if (y <= M) {
    int tmp = get(t << 1, y);
    if (tmp != -1) return tmp;
  }
  return get(t << 1 | 1, y);
}
int cal(int t) {
  int p = head[t];
  int ans = edges[p].id;
  edges[p].cnt--;
  if (edges[p].cnt == 0) {
    head[t] = edges[p].next;
  }
  return ans;
}
int main() {
  n = myInt();
  for (int i = 1; i <= n; i++) {
    p[i].L = myInt();
    p[i].R = myInt();
    p[i].cnt = i;
    b[++bNum] = p[i].L;
    b[++bNum] = p[i].R;
  }
  m = myInt();
  for (int i = 1; i <= m; i++) {
    q[i].L = myInt();
    q[i].R = myInt();
    q[i].cnt = myInt();
    q[i].id = i;
    b[++bNum] = q[i].L;
    b[++bNum] = q[i].R;
  }
  sort(b + 1, b + bNum + 1);
  int M = unique(b + 1, b + bNum + 1) - (b + 1);
  for (int i = 1; i <= n; i++) {
    p[i].L = lower_bound(b + 1, b + M + 1, p[i].L) - b;
    p[i].R = lower_bound(b + 1, b + M + 1, p[i].R) - b;
  }
  for (int i = 1; i <= m; i++) {
    q[i].L = lower_bound(b + 1, b + M + 1, q[i].L) - b;
    q[i].R = lower_bound(b + 1, b + M + 1, q[i].R) - b;
  }
  build(1, 1, M);
  sort(p + 1, p + n + 1, cmp);
  sort(q + 1, q + m + 1, cmp);
  memset(head, -1, sizeof(head));
  int cur = 1;
  for (int i = 1; i <= n; i++) {
    while (cur <= m && q[cur].L <= p[i].L) {
      insert(1, q[cur].R, q[cur].cnt);
      add(q[cur].id, q[cur].cnt, q[cur].R);
      cur++;
    }
    int t = get(1, p[i].R);
    if (t == -1) {
      puts("NO");
      return 0;
    }
    insert(1, t, -1);
    ans[p[i].cnt] = cal(t);
  }
  puts("YES");
  for (int i = 1; i <= n; i++) {
    printf("%d", ans[i]);
    if (i < n) putchar(' ');
  }
  puts("");
}
