#include using namespace std; using ll = long long; int main(){ int n; cin >> n; vector> P(n-1); for(int i = 0; i < n-1; i++){ int num; cin >> num; P[i].first = num; P[i].second = i; } sort(P.begin(), P.end()); vector ans(n-1); for(int i = 0; i < n-1; i++){ if(i+2<=P[i].first){ cout << "NO" << endl; return 0; }else{ ans[P[i].second] = i+2-P[i].first; } } cout << "YES" << endl; for(int i = 0; i < n-1; i++){ cout << ans[i] << endl; } return 0; }