#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
int N, x[maxn + 20], y[maxn + 20], fw[maxn + 20];
vector<int> v[2 * maxn + 100], res;
bool comp(int a, int b) {
  if (x[a] == x[b]) return y[a] > y[b];
  return x[a] > x[b];
}
void upd(int a, int b) {
  for (int i = a; i <= maxn + 1; i += i & (-i)) fw[i] = max(fw[i], b);
}
int find(int a) {
  int ret = -1;
  for (int i = a; i > 0; i -= i & (-i)) ret = max(ret, fw[i]);
  return ret;
}
int main() {
  memset(fw, -1, sizeof fw);
  cin >> N;
  for (int i = 1; i <= N; i++) {
    scanf("%d %d", &x[i], &y[i]);
    v[y[i] - x[i] + maxn].push_back(i);
  }
  for (int i = 0; i <= 2 * maxn; i++) sort(v[i].begin(), v[i].end(), comp);
  for (int i = 1; i <= N; i++) {
    int a;
    scanf("%d", &a);
    a += maxn;
    if (!v[a].size()) {
      printf("NO\n");
      return 0;
    }
    res.push_back(v[a].back());
    v[a].pop_back();
  }
  for (int i = 0, asd = 0; i < N; i++, asd = 0) {
    asd = find(maxn - x[res[i]] + 1);
    if (asd >= y[res[i]]) {
      printf("NO\n");
      return 0;
    }
    upd(maxn - x[res[i]] + 1, y[res[i]]);
  }
  printf("YES\n");
  for (int i = 0; i < N; i++) printf("%d %d\n", x[res[i]], y[res[i]]);
  return 0;
}
