#include <bits/stdc++.h>
using namespace std;
int X[100005], Y[100005], W[100005];
pair<int, int> R[100005];
set<pair<int, int> > S[100000 + 100005], s;
bool is_pleasing(int idx) {
  if (!R[idx].first && !R[idx].second) {
    s.insert(R[idx]);
    return true;
  }
  if (!R[idx].first) {
    if (s.find(pair<int, int>(0, R[idx].second - 1)) == s.end()) return false;
    s.insert(R[idx]);
    return true;
  }
  if (!R[idx].second) {
    if (s.find(pair<int, int>(R[idx].first - 1, 0)) == s.end()) return false;
    s.insert(R[idx]);
    return true;
  }
  if (s.find(pair<int, int>(R[idx].first - 1, R[idx].second)) == s.end() ||
      s.find(pair<int, int>(R[idx].first, R[idx].second - 1)) == s.end())
    return false;
  s.insert(R[idx]);
  return true;
}
bool solve(int n) {
  int i;
  for (i = 0; i < n; ++i)
    S[100000 + Y[i] - X[i]].insert(pair<int, int>(X[i], Y[i]));
  for (i = 0; i < n; ++i)
    if (S[100000 + W[i]].empty())
      return false;
    else {
      R[i] = *S[100000 + W[i]].begin();
      if (!is_pleasing(i)) return false;
      S[100000 + W[i]].erase(S[100000 + W[i]].begin());
    }
  return true;
}
int main() {
  int n, i;
  scanf("%d", &n);
  for (i = 0; i < n; ++i) scanf("%d %d", X + i, Y + i);
  for (i = 0; i < n; ++i) scanf("%d", W + i);
  if (solve(n)) {
    puts("YES");
    for (i = 0; i < n; ++i) printf("%d %d\n", R[i].first, R[i].second);
  } else
    puts("NO");
  return 0;
}
