#include <bits/stdc++.h> using namespace std; //#define int long long typedef long long ll; typedef long double ld; bool good; vector<pair<ll, ll>> ans; void solve_for(ll curr_x, ll curr_y, ll a, ll b, vector<ll> d) { ans.emplace_back(curr_x, curr_y); ll summ_d = 0; ll mx = 0; for (auto elem : d) { summ_d += elem; mx = max(mx, elem); } ll r = summ_d - a - b; if (r < 0 || r % 2 == 1) { assert(curr_x == 0 && curr_y == 0); good = false; return; } r /= 2; if (mx > a + b + r) { assert(curr_x == 0 && curr_y == 0); good = false; return; } if (d[0] >= r) { if (d[0] >= a + r) { curr_x = curr_x + a + r; curr_y = curr_y + d[0] - (a + r); ans.emplace_back(curr_x, curr_y); for (int i = 1; i < d.size(); ++i) { if (curr_y + d[i] <= b) { curr_y += d[i]; } else { curr_x -= (curr_y + d[i]) - b; curr_y = b; } ans.emplace_back(curr_x, curr_y); } } else { curr_y = curr_y - r; curr_x += (a + r) - d[0]; b += r; a -= (a + r) - d[0]; d.erase(d.begin()); solve_for(curr_x, curr_y, a, b, d); } } else { curr_y -= r; b += r; d.erase(d.begin()); solve_for(curr_x, curr_y, a, b, d); } } void solve() { int n; cin >> n; ll a, b; cin >> a >> b; ll curr_x = 0, curr_y = 0; vector<ll> d(n - 1); for (int i = 0; i < n - 1; ++i) { cin >> d[i]; } good = true; solve_for(curr_x, curr_y, a, b, d); if (!good) { cout << "NO\n"; } else { cout << "YES\n"; for (auto elem : ans) { cout << elem.first << " " << elem.second << "\n"; } } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifdef LC freopen("/home/team11/CLionProjects/contest/input.txt", "r", stdin); freopen("/home/team11/CLionProjects/contest/output.txt", "w", stdout); #endif int t= 1 ; //cin >> t; for (int tt =0; tt <t; tt++) { solve(); } return 0; }