//#pragma GCC optimize("unrool-loop")
//#pragma GCC target("avx2")
#include <bits/stdc++.h>
//#define int int64_t
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define loop(i,s,e) for(int i=s; i<e; i++)
#define x first
#define y second
#define all(a) a.begin(),a.end()
#define pb push_back
const ll INF = 1e18;
const int M = 24;
ll values[(1 << M) + 1];
vi find_comb(int n, vi& d, ll X, ll Y) {
    if (n <= M) {
        int amt = (1LL << n);
        ll ans = -1;
        loop(mask, 0, amt) {
            ll sum = 0;
            for(int x=mask, i; x; x ^= (1<<i)) {
                i = __builtin_ctz(x);
                sum += d[i];
            }
            if (sum >= X && sum <= Y) {
                ans = mask;
                break;
            }
        }
        if (ans == -1) return {-1};
        vector<int> res;
        loop(i,0,n) if(ans&(1LL<<i)) res.pb(i);
        return res;
    }
    int amt = (1 << M);
    loop(mask, 0, amt) {
        ll sum = 0;
//        loop(i,0,M) if(mask&(1<<i)) sum+=d[i];
        for(int x=mask, i; x; x ^= (1<<i)) {
            i = __builtin_ctz(x);
            sum += d[i];
        }
        values[mask] = sum;
    }
    sort(values, values+amt);
    values[amt] = INF;
    int amt2 = (1 << (n - M));
    int ans2 = -1, value1=-1;
    loop(mask, 0, amt2) {
        ll sum2 = 0;
//        loop(i,0,n-M) if(mask&(1<<i)) sum2+=d[M+i];
        for(int x=mask, i; x; x ^= (1<<i)) {
            i = __builtin_ctz(x);
            sum2 += d[M + i];
        }
//        sum2 = d[__builtin_ctz(mask)];
        if (sum2 > Y || sum2+values[amt-1]<X) continue;
        int sum1 = *lower_bound(values, values+amt, X - sum2), s = sum1 + sum2;
        if (s >= X && s <= Y) {
            ans2 = mask;
            value1 = sum1;
            break;
        }
    }
    if (ans2 == -1) return {-1};
    int ans1 = -1;
    loop(mask, 0, amt) {
        ll sum = 0;
//        loop(i,0,M) if(mask&(1<<i)) sum+=d[i];
        for(int x=mask, i; x; x ^= (1<<i)) {
            i = __builtin_ctz(x);
            sum += d[i];
        }
        if (sum == value1) {
            ans1 = mask;
            break;
        }
    }
    vector<int> res;
    loop(i,0,M) if(ans1&(1LL<<i)) res.pb(i);
    loop(i,0,n-M) if(ans2&(1LL<<i)) res.pb(M+i);
    return res;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    auto t = chrono::high_resolution_clock::now();
    int n; cin>>n; n--;
    int a,b; cin>>a>>b;
    bool trans = 0;
    if (b < a) swap(a, b), trans = 1;
    vector<int> d(n); loop(i,0,n) cin>>d[i];
    ll sum = 0;
    loop(i,0,n) sum+=d[i];
    if (sum < a+b) return cout<<"NO"<<endl,0;
    ll diff = sum - (a+b);
    if (diff % 2 != 0) return cout<<"NO"<<endl,0;
    ll X = diff / 2;
    vi inds = find_comb(n, d, X, X+b);
    if (inds.size() && inds[0]==-1) return cout<<"NO"<<endl,0;
    vector<pair<ll, ll>> ps(n);
    pair<ll, ll> cur;
    vi in_inds(n);
    for(int i:inds) {
        in_inds[i] = 1;
        ll dd =d[i];
        if (cur.x > -X) {
            if (cur.x - dd >= -X) {
                cur.x -= dd;
                ps[i] = {-dd, 0};;
            } else {
                ps[i].x = -(cur.x - (-X));
                ps[i].y = dd - abs(ps[i].x);
                cur.x += ps[i].x;
                cur.y += ps[i].y;
            }
        } else {
            ps[i].y = dd;
            cur.y += dd;
        }
    }
    loop(i,0,n) {
        if (!in_inds[i]) {
            ll dd = d[i];
            if (cur.x < a) {
                if (cur.x + dd <= a) {
                    cur.x += dd;
                    ps[i].x = dd;
                } else {
                    ps[i].x = a - cur.x;
                    ps[i].y = dd - ps[i].x;
                    cur.x += ps[i].x;
                    cur.y += ps[i].y;
                }
            } else {
                ps[i].y = dd;
                cur.y += dd;
            }
        }
    }
    vector<pair<ll, ll>> ans(n+1); ans[0] = {0,0};;
    loop(i,0,n) {
        ans[i+1].x = ans[i].x + ps[i].x;
        ans[i+1].y = ans[i].y + ps[i].y;
    }
    if (trans) {
        loop(i,0,n+1) swap(ans[i].x, ans[i].y);
    }
    cout << "YES" << endl;
    loop(i,0,n+1) {
        cout << ans[i].x<<" "<<ans[i].y<<endl;
    }
    auto s = chrono::high_resolution_clock::now();
    auto rv = chrono::duration_cast<chrono::milliseconds>(s-t).count();
//    cout << "Took: "<<rv<<" ms"<<endl;
    return 0;
}