#include <bits/stdc++.h> using namespace std; #define int long long pair<int,int> fix(pair<int,int> pr){ if (pr.first <= 0 && pr.second >= 0){ return {0ll, max(pr.second, abs(pr.first))}; } else if (pr.first > 0){ return {pr.first, pr.second}; } else { return {pr.second, pr.first}; } } vector<pair<int,int>> compressle(vector<pair<int,int>> &arr){ sort(arr.begin(), arr.end()); vector<pair<int,int>> ret(1, arr[0]); for (int i = 1; i < arr.size(); i++){ if (ret.back().second >= arr[i].first){ ret.back().second = max(ret.back().second, arr[i].second); } else { ret.push_back(arr[i]); } } return ret; } pair<int,int> eksik(int a, int b){ return {(a + b)/2, (a - b)/2}; } bool ret; pair<int,int> cakistir(vector<pair<int,int>> &arr, pair<int,int> p, int d){ ret = true; int a = p.first; int b = p.second; for (int i = 0; i < arr.size(); i++){ auto p1i = eksik(min(arr[i].first, a+b+d),max(-arr[i].first, a-b+d)); auto p2i = eksik(max(-arr[i].first,a+b-d),min(arr[i].first,a-b-d)); auto p3i = eksik(min(arr[i].second, a+b+d),max(-arr[i].second, a-b+d)); auto p4i = eksik(max(-arr[i].second,a+b-d),min(arr[i].second,a-b-d)); if (man(p1i) >= arr[i].first && man(p1i) <= arr[i].second) return p1i; if (man(p2i) >= arr[i].first && man(p2i) <= arr[i].second) return p2i; if (man(p3i) >= arr[i].first && man(p3i) <= arr[i].second) return p3i; if (man(p4i) >= arr[i].first && man(p4i) <= arr[i].second) return p14i; } } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n;cin>>n; int a,b;cin>>a>>b; vector<vector<pair<int,int>>> valids; valids.push_back(vector<pair<int,int>>(1,{0,0})); vector<int> posi(1,23); for (int i = 0; i < n-1; i++){ int x;cin>>x; posi.push_back(x); vector<pair<int,int>> nxt; for (auto it : valids.back()) { nxt.push_back(fix({it.first - x, it.second + x})); nxt.push_back(fix({it.first + x, it.second + x})); nxt.push_back(fix({it.first - x, it.first + x})); nxt.push_back(fix({it.second - x, it.second + x})); } valids.push_back(compressle(nxt)); } if ((valids.back()[0].first & 1) != ((a + b) & 1)){ cout<<"NO"<<endl; return 0; } auto pr = cakistir(valids.back(), {a, b}, 0); if (ret == false){ cout<<"NO"<<endl; return 0; } vector<pair<int,int>> ans; ans.push_back({a, b}); for (int i = valids.size() - 2; i >= 0; i--){ auto pr = cakistir(valids[i], ans.back(), posi[i+1]); if (ret == false){ cout<<"NO"<<endl; return 0; } ans.push_back(pr); } cout<<"YES"<<endl; for (int i = ans.size()-1; i >= 0; i--){ cout<<ans[i].first<<" "<<ans[i].second<<endl; } }