#include<bits/stdc++.h> using namespace std; #define int long long signed main(){ //ios::sync_with_stdio(false); //cin.tie(0); int n; cin>>n; long long a,b; cin>>a>>b; n--; vector<long long> d(n); long long sum=0; for(auto &i : d){ cin>>i; sum+=i; } long long k = (sum-(a+b)); //cout<<sum<<"\n"; if(k<0 || k%2!=0){ //cout<<k<<" ecco\n"; cout<<"NO\n"; return 0; }else{ k = k/2; sort(d.begin(),d.end()); int px=0,py=0; if(abs(a-px)+abs(b-py)+(sum-(abs(a-px)+abs(b-py)))/2 < d.back()){ cout<<"NO\n"; return 0; } cout<<"YES\n"; while(!d.empty()){ int lastx=px,lasty=py; assert(abs(a-px)+abs(b-py)+(sum-(abs(a-px)+abs(b-py)))/2 >= d.back() && sum-(abs(a-px)+abs(b-py))>=0); int x = d.back(); d.pop_back(); int rim = (sum-(abs(a-px)+abs(b-py)))/2; if(x<=rim){ //cout<<"A\n"; if(px<a){ px-=x; }else{ px+=x; } }else if(x<=rim+abs(a-px)){ //cout<<"B\n"; if(py<b){ py-=rim; }else{ py+=rim; } if(px<a){ px+=x-rim; }else{ px-=x-rim; } }else if(x<=rim+abs(b-py)){ //cout<<"C\n"; if(px<a){ px-=rim; }else{ px+=rim; } if(py<b){ py+=x-rim; }else{ py-=x-rim; } }else{ //cout<<"D\n"; if(px<a){ px+=x-abs(b-py); }else{ px-=x-abs(b-py); } py = b; } assert(abs(px-lastx)+abs(py-lasty)==x); sum-=x; cout<<px<<" "<<py<<"\n"; } assert(px==a && py==b); } }