// Задача "Электричество"
// 10-ая Всероссийская командная олимпиада школьников по программированию
// Автор задачи: Владимир Гуровиц
// Автор решения: Сергей Поромов, poromov@rain.ifmo.ru

import java.io.*;
import java.util.*;

public class electro_sp implements Runnable {

	public static void main(String[] args) {
		new Thread(new electro_sp()).start();
	}

	public void run() {
		try {
			Locale.setDefault(Locale.US);
			br = new BufferedReader(new FileReader(FILENAME + ".in"));
			out = new PrintWriter(FILENAME + ".out");
			solve();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	void myAssert(boolean e, String s) {
		if (!e) {
			throw new Error("Assertion failure " + s);
		}
	}
	
	void inBounds(int x, int l, int r, String name) {
		myAssert(l <= x && x <= r, "Wrong value of " + name);
	}

	private static final String FILENAME = "electro";
	
	final int MAXK = 100000;
	final int MAXN = 100000;
	
	class Filter implements Comparable<Filter> {
		int a, b, n, to;
		
		Filter(int a, int b, int n) {
			this.a = a;
			this.b = b;
			this.n = n;
			to = -1;
			inBounds(a, 2, 100000, "a[" + (n + 1) + "]");
			inBounds(b, 1, (int)1e9,  "b[" + (n + 1) + "]");
		}

		@Override
		public int compareTo(Filter o) {
			return o.b - b;
		}
		
	}
	
	class Device implements Comparable<Device> {
		int c, n, to;
		
		Device(int c, int n) {
			this.c = c;
			this.n = n;
			inBounds(c, 1, (int)1e9,  "c[" + (n + 1) + "]");
			to = -1;
		}

		@Override
		public int compareTo(Device o) {
			return o.c - c;
		}
	}

	public void solve() {
		int k = nextInt();
		inBounds(k, 1, MAXK, "k");
		Filter[] f = new Filter[k];
		for (int i = 0; i < k; i++) {
			f[i] = new Filter(nextInt(), nextInt(), i);
		}
		int n = nextInt();
		inBounds(n, 1, MAXN, "n");
		Device[] d = new Device[n];
		for (int i = 0; i < n; i++) {
			d[i] = new Device(nextInt(), i);
		}
		Arrays.sort(f);
		Arrays.sort(d);
		int ce = 1;
		int i = 0;
		while (i < k && ce < n) {
			ce += f[i].a - 1;
			if (i > 0) {
				f[i].to = f[i - 1].n + 1;
			} else {
				f[i].to = 0;
			}
			i++;
		}
		if (ce < n) {
			out.println("No");
			return;
		}
		long[] w = new long[k];
		int j = 0;
		int ii = 0;
		while (ii < i && j < n) {
			for (int jj = 0; jj < f[ii].a - 1 && j < n; jj++, j++) {
				d[j].to = f[ii].n + 1;
				w[ii] += d[j].c;
			}
			ii++;
		}
		if (j == n - 1) {
			if (i == 0) {
				d[j].to = 0; 
			} else {
				d[j].to = f[i - 1].n + 1;
				w[i - 1] += d[j].c;
			}
			j++;
		}
		if (j < n) {
			out.println("No");
			return;
		}
		for (ii = i - 1; ii >= 0; ii--) {
			if (w[ii] > f[ii].b) {
				out.println("No");
				return;
			}
			if (ii > 0) {
				w[ii - 1] += w[ii];
			}
		}
		int[] ansf = new int[k];
		int[] ansd = new int[n];
		for (i = 0; i < k; i++) {
			ansf[f[i].n] = f[i].to;
		}
		for (i = 0; i < n; i++) {
			ansd[d[i].n] = d[i].to;
		}
		out.println("Yes");
		for (i = 0; i < k; i++) {
			out.print(ansf[i] + " ");
		}
		out.println();
		for (i = 0; i < n; i++) {
			out.print(ansd[i] + " ");
		}
		out.println();
	}
}
