#include "bits/stdc++.h" using namespace std; using ll = long long; using P = pair; const ll INF = (1LL << 61); ll mod = 998244353; signed main() { ios::sync_with_stdio(false); cin.tie(0); ll N; cin >> N; vectora(N - 1); for (int i = 0; i < N - 1; i++)cin >> a[i]; vectorans(N - 1, -1); set

st; for (int i = 0; i < N - 1; i++) { st.insert({ a[i], i }); } for (int i = 0; i < N - 1 ; i++) { auto idx = st.upper_bound({ i + 2, -INF }); if (idx == st.begin()) { cout << "NO" << endl; return 0; } idx--; P tmp = *idx; ans[tmp.second] = i + 2 - tmp.first; st.erase(idx); } cout << "YES" << endl; for (int i = 0; i < N - 1; i++) { cout << ans[i] << endl; } return 0; }