#include <bits/stdc++.h> using namespace std; using ll = long long; ll n, a, b, sum, ou, o, u, l, r, cur, lft,cnt; bool mir, done; array<ll,60> d; array<bool,60> v; array<bool,60> V; void bt(int i) { cnt++; if (cnt > 8e7) return; if (l <= cur && cur <= r) { V = v; done = true; } if (done) return; if (cur + lft < l) return; if (cur > r) return; if (i == n) return; lft -= d[i]; cur += d[i]; v[i] = true; bt(i + 1); cur -= d[i]; v[i] = false; bt(i + 1); lft += d[i]; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> a >> b; if (a < 0) { a = -a; mir = true; } for (int i = 1; i < n; i++) { cin >> d[i]; sum += d[i]; } if (a + b > sum || (a + b + sum) % 2) { cout << "NO\n"; return 0; } ou = sum - a; o = (ou + b) / 2; u = ou - o; l = o; r = sum - u; lft = sum; bt(1); if (!done) { cout << "NO\n"; return 0; } cout << "YES\n0 0\n"; ll x = 0, y = 0; for (int i = 1; i < n; i++) { if (V[i]) { int k = min(o, d[i]); o -= k; x += d[i] - k; y += k; } else { int k = min(u, d[i]); u -= k; x += d[i] - k; y -= k; } cout << (mir ? -x : x) << " " << y << "\n"; } } /* 4 10 6 7 8 5 4 -10 -6 7 8 5 */