func_code_string: #include <bits/stdc++.h>   using namespace std;   const int Maxn = 200015;   const int nil = 100005;   int n;   set<pair<int, int> > S;   set<pair<int, int> > T;   int w[Maxn];   vector<pair<int, int> > cand[Maxn];   pair<int, int> res[Maxn];   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       int x, y;       scanf( %d %d , &x, &y);       S.insert(pair<int, int>(x, y));     }     for (int i = 1; i <= n; i++) scanf( %d , &w[i]);     for (set<pair<int, int> >::iterator it = S.begin(); it != S.end(); it++) {       pair<int, int> p = *it;       if (S.find(pair<int, int>(p.first + 1, p.second)) == S.end() &&           S.find(pair<int, int>(p.first, p.second + 1)) == S.end()) {         cand[p.second - p.first + nil].push_back(p);         T.insert(p);       }     }     for (int i = n; i >= 1; i--) {       int diag = w[i] + nil;       if (cand[diag].empty()) {         printf( NO n );         return 0;       }       pair<int, int> p = cand[diag].back();       cand[diag].pop_back();       res[i] = p;       pair<int, int> u = pair<int, int>(p.first - 1, p.second);       if (S.find(u) != S.end() && T.find(u) == T.end()) {         cand[u.second - u.first + nil].push_back(u);         T.insert(u);       }       u = pair<int, int>(p.first, p.second - 1);       if (S.find(u) != S.end() && T.find(u) == T.end()) {         cand[u.second - u.first + nil].push_back(u);         T.insert(u);       }     }     printf( YES n );     for (int i = 1; i <= n; i++) printf( %d %d n , res[i].first, res[i].second);     return 0;   }   