#include int h[100005], l; int A[100005]; int comp_h(int a, int b) { if (A[h[a]] < A[h[b]]) return 1; else return -1; } void swap_h(int a, int b) { int f = h[a]; h[a] = h[b]; h[b] = f; return; } void push(int ne) { h[l] = ne; int p = l; l++; for (; p > 0; p = (p - 1) / 2) if (comp_h((p - 1) / 2, p) > 0) swap_h((p - 1) / 2, p); return; } int pop() { l--; swap_h(0, l); int p = 0; for (;;) { if (2 * p + 2 < l) { if (comp_h(2 * p + 1, 2 * p + 2) > 0) { if (comp_h(p, 2 * p + 2) > 0) swap_h(p, 2 * p + 2); p = 2 * p + 2; } else { if (comp_h(p, 2 * p + 1) > 0) swap_h(p, 2 * p + 1); p = 2 * p + 1; } } else if (2 * p + 1 < l) { if (comp_h(p, 2 * p + 1) > 0) swap_h(p, 2 * p + 1); p = 2 * p + 1; } else break; } return h[l]; } int p[100005]; int root(int n) { if (p[n] != n) p[n] = root(p[n]); return p[n]; } void uni(int x, int y) { x = root(x); y = root(y); p[x] = y; } int main() { int n; scanf("%d", &n); int i, j; for (i = 0; i < n - 1; i++) scanf("%d", &A[i]); l = 0; for (i = 0; i < n - 1; i++) push(i); int c[100005]; for (i = 0; i < n - 1; i++) c[i] = pop(); int ans[100005]; for (i = 0; i < n; i++) p[i] = i; for (i = 0; i < n - 1; i++) { j = n - A[c[i]] - 1; while (root(j) == root(j + A[c[i]])) { j--; if (j < 0) break; } if (j < 0) { printf("NO\n"); return 0; } ans[c[i]] = j + 1; uni(j, j + A[c[i]]); } printf("YES\n"); for (i = 0; i < n - 1; i++) printf("%d\n", ans[i]); return 0; }