#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(int i=a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() #define fo(i, b) for(int i=0; i < (b); ++i) #define F first #define S second #define MP make_pair typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define int ll signed main() { int n, dc=0, a, b; cin >> n >> a >> b; vi d(n-1); fo(i, n-1) { cin >> d[i]; dc += d[i]; } int x=0, y=0; if ((a+b > dc) || ((a + b) % 2 != dc % 2)) { cout << "NO" << endl; return 0; } cout << "YES" << endl; fo(i, n-1) { cout << x << " " << y << endl; if (abs(x-a) + abs(y-b) <= dc - 2*d[i]) { x -= d[i]; } else if (abs(x-a) + abs(y-b) == dc) { if (x + d[i] <= a) { x += d[i]; } else { y += max(0LL, d[i] - abs(x-a)); x = a; } } else { y -= (dc - abs(x-a) - abs(y-b)) / 2; x += d[i] + y; } dc -= d[i]; } cout << a << " " << b << endl; cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); }