#include <bits/stdc++.h> using namespace std; long long inf = 1e18; struct drept { long long x_min, x_max; long long y_min, y_max; drept() {} drept(long long a, long long b, long long c, long long d) { if(a > b) swap(a, b); if(c > d) swap(c, d); x_min = a; x_max = b; y_min = c; y_max = d; } }; long long n, old_a, old_b, a, b; long long d[55]; long long r_mare[55], r_mic[55]; long long max_d[55], sum[55]; pair<long long, long long> ans[55]; pair<long long, long long> inter_drept(drept a, drept b) { long long x_min = max(a.x_min, b.x_min); long long x_max = min(a.x_max, b.x_max); long long y_min = max(a.y_min, b.y_min); long long y_max = min(a.y_max, b.y_max); if(x_min > x_max || y_min > y_max) return {inf, inf}; if(x_min%2==y_min%2) return {x_min, y_min}; else if(x_min<x_max) return {x_min+1, y_min}; else if(y_min<y_max) return {x_min, y_min+1}; else return {inf,inf}; } pair<long long, long long> find_point(pair<long long, long long> last, long long d, long long rad_mare, long long rad_mic) { drept eu[5]; eu[0] = drept(last.first - d, last.first + d, last.second + d, last.second + d); eu[1] = drept(last.first - d, last.first + d, last.second - d, last.second - d); eu[2] = drept(last.first - d, last.first - d, last.second + d, last.second -d); eu[3] = drept(last.first + d, last.first + d, last.second + d, last.second - d); drept el[5]; el[0] = drept(a-rad_mare, a-rad_mic, b-rad_mare, b+rad_mare); el[1] = drept(a+rad_mic, a+rad_mare, b-rad_mare, b+rad_mare); el[2] = drept(a-rad_mare, a+rad_mare, b-rad_mare, b-rad_mic); el[3] = drept(a-rad_mare, a+rad_mare, b+rad_mic, b+rad_mare); for(long long i=0; i<4; i++) for(long long j=0; j<4; j++) { pair<long long, long long> inter = inter_drept(eu[i], el[j]); if(inter != make_pair(inf, inf)) return inter; } exit(1); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin>>n; cin>>old_a>>old_b; a = old_a - old_b; b = old_a + old_b; for(long long i=1;i<n;i++) cin>>d[i]; for(int i=n-1; i>=1; i--) { max_d[i] = max(max_d[i+1], d[i]); sum[i] = sum[i+1] + d[i]; } r_mare[n] = 0; r_mic[n] = 0; for(long long i=n-1; i>=1; i--) { r_mare[i] = r_mare[i+1] + d[i]; r_mic[i] = max(max_d[i] - (sum[i] - max_d[i]), 0ll); } long long dist = max(abs(a), abs(b)); if(dist > r_mare[1] || dist < r_mic[1]) { cout<<"NO\n"; return 0; } ans[1] = {0, 0}; for(long long i=2;i<=n;i++) ans[i] = find_point(ans[i-1], d[i-1], r_mic[i], r_mare[i]); ans[n] = {a, b}; cout<<"YES\n"; for(long long i=1;i<=n;i++) { long long x = (ans[i].first + ans[i].second) / 2; long long y = ans[i].second - x; cout<<x<<' '<<y<<'\n'; } return 0; }