#include using namespace std; // 各操作を先読みしない解法 // O(N^2) がTLEになるかチェック int main() { int N; cin >> N; vector used(N + 1); vector x(N); for (int i = 1; i <= N - 1; ++i) { int a; cin >> a; bool ok = false; for (int j = a + 1; j <= N; ++j) { if (not used[j]) { x[i] = j - a; used[j] = true; ok = true; break; } } if (not ok) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; for (int i = 1; i <= N - 1; ++i) { cout << x[i] << endl; } }