#include <bits/stdc++.h> using namespace std; long long l[55],r[55],mas[55],d[55]; signed main(){ long long n; cin>>n; long long a,b; cin>>a>>b; l[0]=r[0]=a+b; for(long long i=0; i<n-1; i++){ cin>>mas[i]; r[i+1]=r[i]+mas[i]; if(mas[i]<=l[i]){ l[i+1] = l[i]-mas[i]; }else if(mas[i]<=r[i]){ l[i+1] = r[i+1]%2; }else{ l[i+1] = mas[i]-r[i]; } //l[i+1]=max(max(r[i+1]%2,r[i]-mas[i]),l[i]-mas[i]); } if(l[n-1]!=0){ cout<<"NO\n"; return 0; } for(long long i=n-1; i>=0; i--){ d[i]=l[i]; r[i]=l[i]; for(long long j=i; j>0; j--){ r[j-1]=min(r[j-1],r[j]+mas[j-1]); if(mas[j-1]<=l[j]){ l[j-1] = max(l[j-1], l[j]-mas[j-1]); }else if(mas[j-1]<=r[j]){ l[j-1] = max(l[j-1], r[j]%2); }else{ l[j-1] = max(l[j-1], mas[j-1]-r[j]); } } } //for(long long i=0; i<n; i++) cout<<d[i]<<" "; cout<<"YES\n0 0\n"; long long x=0, y=0; for(long long i=0; i<n-1; i++){ //find polong long mas[i] away x,y //thats d[i+1] away from a,b long long offset = d[i+1] - mas[i]; long long test = abs(b - y) - abs(a-x); if(test < offset){ //cout<<"left\n"; long long xd = (abs(b-y)+abs(a-x) - offset) / 2; long long dir = 1; if(a<x) dir = -1; long long px = x+dir*xd, py = y; dir = -1; if(b<y) dir = 1; py += dir * (mas[i] - abs(px-x)); x = px; y = py; }else{ //cout<<"right\n"; long long xd = (offset + abs(b-y) + abs(a-x)) /2; long long dir = 1; if(b>y) dir = -1; long long py = b+dir*xd, px=a; dir = 1; if(a<x) dir=-1; px+=dir * (d[i+1] - abs(py-b)); x=px; y=py; } cout<<x<<" "<<y<<"\n"; } }