#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int n, x[N], y[N];
struct pt {
  int s, id, ans;
} p[N], w[N];
bool cmpID(pt A, pt B) { return A.id < B.id; }
bool cmpSw(pt A, pt B) { return (A.s < B.s) || (A.s == B.s && A.id < B.id); }
bool cmpSp(pt A, pt B) {
  return (A.s < B.s) ||
         (A.s == B.s && x[A.id] <= x[B.id] && y[A.id] <= y[B.id]);
}
int maxX, lb[N << 2], rb[N << 2], maxv[N << 2];
void build(int l, int r, int i) {
  lb[i] = l;
  rb[i] = r;
  maxv[i] = -1;
  if (l < r) {
    build(l, ((lb[i] + rb[i]) / 2), ((i) << 1));
    build(((lb[i] + rb[i]) / 2) + 1, r, (((i) << 1) + 1));
  }
}
void modify(int p, int v, int i) {
  if (lb[i] == rb[i])
    maxv[i] = max(maxv[i], v);
  else {
    if (p <= ((lb[i] + rb[i]) / 2))
      modify(p, v, ((i) << 1));
    else
      modify(p, v, (((i) << 1) + 1));
    maxv[i] = max(maxv[((i) << 1)], maxv[(((i) << 1) + 1)]);
  }
}
int findmax(int l, int r, int i) {
  if (l > r) return -1;
  if (l == lb[i] && r == rb[i]) return maxv[i];
  return max(findmax(l, min(r, ((lb[i] + rb[i]) / 2)), ((i) << 1)),
             findmax(max(l, ((lb[i] + rb[i]) / 2) + 1), r, (((i) << 1) + 1)));
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= (n); i++) {
    scanf("%d%d", &x[i], &y[i]);
    p[i].s = y[i] - x[i];
    p[i].id = i;
    maxX = max(x[i], maxX);
  }
  for (int i = 1; i <= (n); i++) {
    scanf("%d", &w[i].s);
    w[i].id = i;
  }
  sort(p + 1, p + n + 1, cmpSp);
  sort(w + 1, w + n + 1, cmpSw);
  bool flag = true;
  for (int i = 1; i <= (n); i++) {
    w[i].ans = p[i].id;
    if (w[i].s != p[i].s) flag = false;
  }
  if (!flag) {
    printf("NO\n");
    return 0;
  }
  sort(w + 1, w + n + 1, cmpID);
  build(0, maxX, 1);
  for (int i = 1; i <= (n); i++) {
    if (findmax(x[w[i].ans], maxX, 1) >= y[w[i].ans]) flag = false;
    modify(x[w[i].ans], y[w[i].ans], 1);
  }
  if (!flag) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  for (int i = 1; i <= (n); i++) printf("%d %d\n", x[w[i].ans], y[w[i].ans]);
  return 0;
}
