#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int INF = (int)1e9 + 7;
const int SZ = (int)210000;
const long double PI = 3.1415926535897932384626433832795;
vector<pair<int, int>> a[SZ];
int w[SZ];
vector<pair<int, int>> ord;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    a[y - x + (SZ / 2)].push_back({x, y});
  }
  for (int i = 0; i < n; i++) cin >> w[i];
  bool ok = true;
  for (int i = 0; i < SZ; i++) sort(a[i].rbegin(), a[i].rend());
  for (int i = 0; i < n; i++)
    if (!a[w[i] + (SZ / 2)].size())
      ok = false;
    else {
      ord.push_back(a[w[i] + (SZ / 2)].back());
      a[w[i] + (SZ / 2)].pop_back();
    }
  if (!ok) return 0 * printf("NO");
  map<pair<int, int>, int> dd;
  for (int i = 0; i < n; i++) {
    dd.insert({ord[i], i});
  }
  for (auto i : dd) {
    int k, l;
    if (i.first.first == 0)
      k = 0;
    else
      k = dd.find({i.first.first - 1, i.first.second})->second;
    if (i.first.second == 0)
      l = 0;
    else
      l = dd.find({i.first.first, i.first.second - 1})->second;
    if (max(k, l) > i.second) ok = false;
  }
  if (!ok)
    return 0 * printf("NO");
  else {
    cout << "YES\n";
    for (auto i : ord) cout << i.first << " " << i.second << "\n";
  }
  return 0;
}
