#include <bits/stdc++.h>
using namespace std;
map<int, vector<pair<int, int> > > mp;
map<int, int> cnt, pointer;
vector<int> arr(100010);
vector<pair<int, int> > ans;
inline void init() {
  ios_base::sync_with_stdio(0);
  for (int i = -100010; i < 100010; ++i) cnt[i] = -1;
}
int main() {
  bool sisepuede = 1;
  init();
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int l, r;
    cin >> l >> r;
    mp[r - l].push_back({l, r});
    pointer[r - l] = 0;
  }
  for (int i = 0; i < n; ++i) cin >> arr[i];
  for (auto& v : mp) sort(v.second.begin(), v.second.end());
  for (int i = 0; i < n; ++i) {
    if (mp.count(arr[i]) == 0) {
      sisepuede = 0;
      break;
    }
    int x = mp[arr[i]][pointer[arr[i]]].first;
    int y = mp[arr[i]][pointer[arr[i]]].second;
    ++pointer[arr[i]];
    int x1 = x - 1, y1 = y - 1;
    if (x1 >= 0)
      if (cnt[y - x1] == -1) {
        sisepuede = 0;
        break;
      }
    if (y1 >= 0) {
      if (cnt[y1 - x] == -1) {
        sisepuede = 0;
        break;
      }
    }
    ans.push_back(make_pair(x, y));
    cnt[y - x] = 1;
  }
  if (!sisepuede)
    cout << "NO\n";
  else {
    cout << "YES\n";
    for (int i = 0; i < n; ++i)
      cout << ans[i].first << " " << ans[i].second << "\n";
  }
  return 0;
}
