#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
int d1[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
int d2[8][2] = {{1, 0}, {0, 1},  {0, -1}, {-1, 0},
                {1, 1}, {-1, 1}, {1, -1}, {-1, -1}};
int tree[500001];
int arr[100001];
void build(int ind, int L, int R) {
  if (L == R) {
    tree[ind] = arr[L];
  } else {
    build(2 * ind, L, (L + R) / 2);
    build(2 * ind + 1, (L + R) / 2 + 1, R);
    tree[ind] = min(tree[2 * ind], tree[2 * ind + 1]);
  }
}
int query(int ind, int L, int R, int i, int j) {
  if (j < L || R < i) return 1000000;
  if (i <= L && R <= j) {
    return tree[ind];
  }
  return min(query(2 * ind, L, (L + R) / 2, i, j),
             query(2 * ind + 1, (L + R) / 2 + 1, R, i, j));
}
void update(int ind, int L, int R, int i, int val) {
  if (i < L || R < i) return;
  if (L == R) {
    tree[ind] = val;
    return;
  }
  update(2 * ind, L, (L + R) / 2, i, val);
  update(2 * ind + 1, (L + R) / 2 + 1, R, i, val);
  tree[ind] = min(tree[2 * ind], tree[2 * ind + 1]);
}
int w[100001];
int n;
vector<pair<int, int>> points(100001);
map<int, vector<pair<int, int>>> l;
map<int, int> cnt;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> points[i].first >> points[i].second;
    l[points[i].second - points[i].first].push_back(points[i]);
  }
  for (auto& i : l) {
    sort((i.second).begin(), (i.second).end());
  }
  for (int i = 0; i < n; ++i) cin >> w[i];
  for (int i = 0; i <= 100000; ++i) arr[i] = 1000000;
  build(1, 0, 100000);
  vector<pair<int, int>> ans;
  for (int i = 0; i < n; ++i) {
    ((void)0);
    if ((int)(l[w[i]]).size() == cnt[w[i]]) {
      cout << "NO\n";
      return 0;
    }
    ((void)0);
    pair<int, int> val = l[w[i]][cnt[w[i]]];
    int qval = query(1, 0, 100000, val.first, 100000);
    ((void)0);
    if (qval >= val.second && qval != 1000000) {
      cout << "NO\n";
      return 0;
    }
    update(1, 0, 100000, val.first, val.second);
    ans.push_back(val);
    cnt[w[i]]++;
  }
  cout << "YES\n";
  for (auto i : ans) cout << i.first << " " << i.second << "\n";
  return 0;
}
