#include #include #include #include int main() { int n; std::cin >> n; std::vector v(n - 1); for (int &e : v) std::cin >> e; std::vector ord(n - 1); std::iota(std::begin(ord), std::end(ord), 0); std::sort(std::begin(ord), std::end(ord), [&](const int i, const int j) { return v[i] < v[j]; }); int ub = 1; bool yes = true; std::vector ans(n - 1); for (const int idx : ord) { const int d = v[idx]; if (ub < d) { yes = false; break; } ans[idx] = ub - d + 1; ub++; } if (yes) { std::cout << "YES\n"; for (int e : ans) { std::cout << e << "\n"; } } else { std::cout << "NO\n"; } return 0; }