#include <bits/stdc++.h>
using namespace std;
vector<long long> asd[400005], an, ans, ans2[2];
long long N, X[400005], Y[400005], W[400005], v[400005], CON = 100000;
bool func(int a, int b) {
  if (X[a] == X[b]) return Y[a] < Y[b];
  return X[a] < X[b];
}
bool funk(int a, int b) {
  if (Y[a] == Y[b]) return X[a] < X[b];
  return Y[a] < Y[b];
}
void test() {
  for (int i = 0; i < 400005; i++)
    if (asd[i].size() > 1) sort(asd[i].begin(), asd[i].end(), funk);
  memset(v, 0, sizeof v);
  for (int i = 0; i < N; i++) {
    if (v[W[i]] >= asd[W[i]].size()) {
      cout << "NO\n";
      return;
    }
    an.push_back(asd[W[i]][v[W[i]]]);
    v[W[i]]++;
  }
  int mx, my;
  for (int i = 0; i < N; i++) {
    if (i != 0 && mx < X[an[i]] && my < Y[an[i]]) {
      cout << "NO\n";
      return;
    }
    mx = X[an[i]];
    my = Y[an[i]];
  }
  cout << "YES\n";
  for (int i = 0; i < an.size(); i++) {
    int k = an[i];
    cout << X[k] << ' ' << Y[k] << '\n';
  }
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> X[i] >> Y[i];
  for (int i = 0; i < N; i++) cin >> W[i], W[i] += CON;
  for (int i = 0; i < N; i++) asd[Y[i] - X[i] + CON].push_back(i);
  for (int i = 0; i < 400005; i++)
    if (asd[i].size() > 1) sort(asd[i].begin(), asd[i].end(), func);
  for (int i = 0; i < N; i++) {
    if (v[W[i]] >= asd[W[i]].size()) {
      cout << "NO\n";
      return 0;
    }
    ans.push_back(asd[W[i]][v[W[i]]]);
    v[W[i]]++;
  }
  long long mx, my;
  for (int i = ans.size() - 1; i >= 0; i--) {
    if (i != ans.size() - 1 && mx <= X[ans[i]] && my <= Y[ans[i]]) {
      cout << "NO\n";
      return 0;
    }
    mx = X[ans[i]];
    my = Y[ans[i]];
  }
  cout << "YES\n";
  for (int i = 0; i < ans.size(); i++) {
    int k = ans[i];
    cout << X[k] << ' ' << Y[k] << '\n';
  }
}
