#include <cassert>
#include <cstdio>
#include <cstring>
#include <algorithm>

int *a, *b, *c;

bool p1less( const int &i, const int &j )
{
  return b[i] > b[j];
}

bool p2less( const int &i, const int &j )
{
  return c[i] > c[j];
}

int main()
{
  using namespace std;
  assert(freopen("electro.in", "r", stdin) == stdin);
  assert(freopen("electro.out", "w", stdout) == stdout);

  int k, n;
  assert(scanf("%d", &k) == 1);
  int *a = new int[k], *b = new int[k], *p1 = new int[k];
  for (int i = 0; i < k; i++)
    assert(scanf("%d%d", &a[i], &b[i]) == 2), p1[i] = i;
  assert(scanf("%d", &n) == 1);
  int *c = new int[n], *p2 = new int[n];
  for (int i = 0; i < n; i++)
    assert(scanf("%d", &c[i]) == 1), p2[i] = i;
  ::a = a, ::b = b, ::c = c;
  sort(p1, p1 + k, p1less);
  sort(p2, p2 + n, p2less);
  if (n == 1)
  {
    assert(puts("Yes") >= 0);
    for (int i = 0; i < k; i++)
      assert(printf("-1%c", "\n "[i < k - 1]) >= 0);
    for (int i = 0; i < n; i++)
      assert(printf("0%c", "\n "[i < n - 1]) >= 0);
  }
  else
  {
    int j = 0, cnt = 0, *use = new int[n];
    for (int i = 0; i < n; i++)
    {
      if (j < k - 1 && cnt >= a[p1[j]] - 1)
        j++, cnt = 0;
      cnt++, use[i] = j;
    }
    if (cnt > a[p1[j]])
      assert(puts("No") >= 0);
    else
    {
      int *sum = new int[k], *ans1 = new int[k], *ans2 = new int[n];
      memset(sum, 0, sizeof(sum[0]) * k);
      for (int i = n - 1; i >= 0; i--)
      {
        sum[use[i]] += c[p2[i]];
        if (i < n - 1 && use[i] != use[i + 1])
          sum[use[i]] += sum[use[i + 1]];
      }
      bool good = true;
      for (int i = 0; i < k; i++)
        if (sum[i] > b[p1[i]])
          good = false, i = k;
      if (!good)
        assert(puts("No") >= 0);
      else
      {
        ans1[p1[0]] = 0;
        for (int i = 1; i < k; i++)
          ans1[p1[i]] = p1[i - 1] + 1;
        for (int i = 0; i < n; i++)
          ans2[p2[i]] = p1[use[i]] + 1;
        assert(puts("Yes") >= 0);
        for (int i = 0; i < k; i++)
          assert(printf("%d%c", ans1[i], "\n "[i < k - 1]) >= 0);
        for (int i = 0; i < n; i++)
          assert(printf("%d%c", ans2[i], "\n "[i < n - 1]) >= 0);
      }
      delete[] sum, delete[] ans1, delete[] ans2;
    }
    delete[] use;
  }

  delete[] a, delete[] b, delete[] c, delete[] p1, delete[] p2;
  return 0;
}

