#include <bits/stdc++.h> #define ll long long using namespace std; struct rect { ll x, X; ll y, Y; }; rect isect(rect a, rect b) { return {max(a.x, b.x), min(a.X, b.X), max(a.y, b.y), min(a.Y, b.Y)}; } pair<ll, ll> isect(ll m, ll M, ll x, ll y, ll d) { //cout << "isect" << m << ":" << M << " " << x << " " << y << ":" << d << endl; ll x_ = x + y; ll y_ = x - y; vector<rect> r1 = { {m, M, -M, M}, {-M, -m, -M, M}, {-M, M, m, M}, {-M, M, -M, m}, }; vector<rect> r2 = { {x - d, x - d, x - d, x + d}, {x + d, x + d, x - d, x + d}, {x - d, x + d, x - d, x - d}, {x - d, x + d, x + d, x + d}, }; for (auto R1: r1) { for (auto R2: r2) { rect R = isect(R1, R2); if (R.X < R.x || R.Y < R.y) continue; return {(R.x + R.y) / 2, (R.x - R.y) / 2}; } } } int main() { int n; cin >> n; ll x, y; cin >> x >> y; vector<ll> d(n - 1); for (int i = 0; i < n - 1; i++) { cin >> d[i]; } vector<pair<ll, ll>> ivs{{0, 0}}; for (int i = 0; i < n - 1; i++) { auto [m, M] = ivs.back(); ivs.push_back({m > d[i] ? m - d[i] : (M < d[i] ? d[i] - M : 0), M + d[i]}); } auto [m, M] = ivs[n-1]; ll D = abs(x) + abs(y); bool okay = true; if (D < m || D > M) okay = false; if ((D & 1) != (M & 1)) okay = false; if (okay) { vector<pair<ll, ll>> pos{{x, y}}; ivs.pop_back(); reverse(ivs.begin(), ivs.end()); int i = n - 2; for (auto [m, M]: ivs) { auto [x_, y_] = isect(m, M, x, y, d[i--]); pos.push_back({x_, y_}); x = x_, y = y_; } cout << "YES\n"; reverse(pos.begin(), pos.end()); for (auto [x, y]: pos) { cout << x << ":" << y << "\n"; } } else { cout << "NO\n"; } }