#include <bits/stdc++.h>
using namespace std;
int n, w[100001];
vector<pair<pair<int, int>, int> > rev;
map<int, vector<pair<int, int> > > mp;
map<int, vector<int> > mpi;
map<int, int> wmp;
pair<int, int> re[100001];
priority_queue<pair<int, int> > pq;
void input() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    pq.push(pair<int, int>(b, a));
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &w[i]);
    mpi[w[i]].push_back(i);
    wmp[w[i]]++;
  }
}
void solve() {
  input();
  while (!pq.empty()) {
    vector<pair<int, int> > tmp;
    tmp.push_back(pq.top());
    pq.pop();
    while (!pq.empty() && tmp[0].first == pq.top().first) {
      tmp.push_back(pq.top());
      pq.pop();
    }
    int idx;
    for (int i = 0; i < tmp.size(); i++) {
      int W = tmp[i].first - tmp[i].second;
      if (mpi[W].empty()) {
        puts("NO");
        return;
      }
      re[mpi[W][mpi[W].size() - 1]] = tmp[i];
      if (i && idx < mpi[W][mpi[W].size() - 1]) {
        puts("NO");
        return;
      }
      idx = mpi[W][mpi[W].size() - 1];
      mpi[W].pop_back();
    }
  }
  puts("YES");
  for (int i = 0; i < n; i++) printf("%d %d\n", re[i].second, re[i].first);
}
int main(void) {
  solve();
  return 0;
}
