#include <bits/stdc++.h>
using namespace std;
template <class T>
void out(T A[], int n) {
  for (int i = 0; i < n; i++) cout << A[i] << " ";
  cout << endl;
}
template <class T>
void out(vector<T> A, int n = -1) {
  if (n == -1) n = A.size();
  for (int i = 0; i < n; i++) cout << A[i] << " ";
  cout << endl;
}
const int N = 100000 + 5;
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
int n;
int w[N];
map<pair<int, int>, int> indegree;
pair<int, int> a[2 * N];
vector<pair<int, int> > ans;
int topsort() {
  for (int i = 0; i < n; ++i) {
    pair<int, int> t = a[w[i] + N], tt;
    a[w[i] + N] = make_pair(-1, -1);
    ans.push_back(t);
    if (t.first == -1) return 0;
    tt = make_pair(t.first + 1, t.second);
    if (indegree.count(tt)) {
      --indegree[tt];
      if (indegree[tt] == 0) a[tt.second - tt.first + N] = tt;
    }
    tt = make_pair(t.first, t.second + 1);
    if (indegree.count(tt)) {
      --indegree[tt];
      if (indegree[tt] == 0) a[tt.second - tt.first + N] = tt;
    }
  }
  return 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x, y, d = 2;
    scanf("%d%d", &x, &y);
    if (x == 0) --d;
    if (y == 0) --d;
    indegree[make_pair(x, y)] = d;
  }
  for (int i = 0; i < n; ++i) scanf("%d", &w[i]);
  for (int i = 0; i < 2 * N; ++i) a[i] = make_pair(-1, -1);
  a[N] = make_pair(0, 0);
  if (topsort()) {
    printf("YES\n");
    for (int i = 0; i < ans.size(); ++i)
      printf("%d %d\n", ans[i].first, ans[i].second);
  } else {
    printf("NO\n");
  }
  return 0;
}
