#include<bits/stdc++.h> #define f first #define s second #define all(x) (x).begin(),(x).end() #define ll long long #define pb push_back #define sz(x) (int)(x).size() using namespace std; bool solvable(int a,int b,vector<pair<ll,int>> x){ sort(all(x)); reverse(all(x)); ll sm=0; for(int i=1;i<sz(x);i++)sm+=x[i].f; if(sm+x[0].f<abs(a)+abs(b))return false; if(x[0].f-sm>abs(a)+abs(b))return false; if((abs(a)+abs(b))%2!=(sm+x[0].f)%2)return false; return true; } pair<int,int> bac(int x,int y){ return {(x+y)/2,(x-y)/2}; } int main(){ int n; ll a,b; cin >> n >> a >> b; n--; vector<pair<ll,int>> red; vector<pair<int,int>> ans(n); for(int i=0;i<n;i++){ int d; cin >> d; red.pb({d,i}); } sort(all(red)); reverse(all(red)); if(!solvable(a,b,red)){ printf("NO\n"); return 0; } vector<int> dx={1,-1,0,0},dy={0,0,1,-1}; for(int i=0;i<n-2;i++){ int d=red.back().f,ind=red.back().s; red.pop_back(); bool fnd=0; for(int k=0;k<4;k++){ a+=dx[k]*d; b+=dy[k]*d; if(solvable(a,b,red)){ ans[ind]={-dx[k]*d,-dy[k]*d}; fnd=1; break; } a-=dx[k]*d; b-=dy[k]*d; } assert(fnd); } ll x=a+b,y=a-b; ll xmin=max(-red[0].f,x-red[1].f); ll ymin=max(-red[0].f,y-red[1].f); ll xmax=min(red[0].f,x+red[1].f); ll ymax=min(red[0].f,y+red[1].f); assert(xmin<=xmax); assert(ymin<=ymax); vector<pair<ll,ll>> cand={bac(xmin,ymin),bac(xmin,ymax),bac(xmax,ymax),bac(xmax,ymin)}; bool ok=0; for(auto p:cand){ if(abs(a-p.f)+abs(b-p.s)==red[1].f&&abs(p.f)+abs(p.s)==red[0].f){ ok=1; ans[red[0].s]=p; ans[red[1].s]={a-p.f,b-p.s}; } } printf("YES\n"); printf("0 0\n"); ll aa=0,bb=0; for(int i=0;i<n;i++){ aa+=ans[i].f; bb+=ans[i].s; printf("%lld %lld\n",aa,bb); } assert(ok); }