#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > arr;
vector<int> buc[112345];
int tree[112345], n;
map<int, priority_queue<int> > M;
int Q[112345];
int QQ[112345];
int ans[112345][2];
void update(int idx, int val) {
  while (idx < 112345) {
    tree[idx] += val;
    idx += (idx & -idx);
  }
}
int read(int idx) {
  int sum = 0;
  while (idx > 0) {
    sum += tree[idx];
    idx -= (idx & -idx);
  }
  return sum;
}
bool cmp(pair<int, int> l, pair<int, int> r) {
  if (l.second == r.second) {
    return l.first < r.first;
  } else {
    return l.second < r.second;
  }
}
bool solve() {
  for (int i = n; i > 0; i--) {
    for (int j = 0; j < buc[i].size(); j++) {
      int idx = buc[i][j];
      int s = arr[idx].second - arr[idx].first;
      if (M.find(s) != M.end()) {
        if (M[s].size()) {
          int tp = M[s].top();
          M[s].pop();
          ans[tp][0] = arr[idx].first;
          ans[tp][1] = arr[idx].second;
        } else
          return false;
      } else {
        return false;
      }
    }
  }
  for (int i = 0; i < 112345; i++) Q[i] = -1;
  for (int i = 0; i < 112345; i++) QQ[i] = -1;
  for (int i = 1; i <= n; i++) {
    if (Q[ans[i][0]] > ans[i][1] || QQ[ans[i][1]] > ans[i][0]) {
      return false;
    } else {
      Q[ans[i][0]] = ans[i][1];
      QQ[ans[i][1]] = ans[i][0];
    }
  }
  return true;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a++;
    b++;
    arr.push_back(make_pair(a, b));
  }
  for (int i = 0; i < n; i++) {
    int m;
    scanf("%d", &m);
    if (M.find(m) != M.end()) {
      M[m].push(i + 1);
    } else {
      priority_queue<int> q;
      q.push(i + 1);
      M.insert(make_pair(m, q));
    }
  }
  sort(arr.begin(), arr.end(), cmp);
  for (int i = 0; i < n; i++) {
    update(arr[i].first, 1);
    int cnt = read(arr[i].first);
    buc[cnt].push_back(i);
  }
  bool flag = solve();
  if (flag) {
    printf("YES\n");
    for (int i = 1; i <= n; i++) {
      printf("%d %d\n", ans[i][0] - 1, ans[i][1] - 1);
    }
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
