mod io { #[macro_export] macro_rules! scan { ($r:expr, [$t:tt; $n:expr]) => ( (0..$n).map(|_| scan!($r, $t)).collect::>() ); ($r:expr, ($($t:tt),*)) => (($(scan!($r, $t)),*)); ($r:expr, Usize1) => (scan!($r, usize) - 1); ($r:expr, String) => (String::from_utf8(scan!($r, Bytes)).unwrap()); ($r:expr, Bytes) => (io::scan($r)); ($r:expr, Chars) => (scan!($r, String).chars().collect::>()); ($r:expr, $t:ty) => (scan!($r, String).parse::<$t>().unwrap()); } use std::io::{BufRead, ErrorKind}; pub fn scan(r: &mut R) -> Vec { let mut buf = Vec::new(); loop { let (done, used) = { let available = match r.fill_buf() { Ok(n) => n, Err(ref e) if e.kind() == ErrorKind::Interrupted => continue, Err(e) => panic!(e), }; match available.iter().position(u8::is_ascii_whitespace) { Some(i) => { buf.extend_from_slice(&available[..i]); (buf.len() > 0, i + 1) } None => { buf.extend_from_slice(available); (false, available.len()) } } }; r.consume(used); if done || used == 0 { return buf; } } } } use std::io::{BufRead, Write}; fn run(reader: &mut R, writer: &mut W) { let n = scan!(reader, usize); let a = scan!(reader, [usize; n - 1]); let mut ord = (0..(n - 1)).collect::>(); ord.sort_by_key(|&i| std::cmp::Reverse(a[i])); let mut ans = vec![0; n - 1]; for (k, i) in ord.into_iter().enumerate() { if n <= k + a[i] { writeln!(writer, "NO").ok(); return; } ans[i] = n - k - a[i]; } writeln!(writer, "YES").ok(); for ans in ans { writeln!(writer, "{}", ans).ok(); } } fn main() { let (stdin, stdout) = (std::io::stdin(), std::io::stdout()); let mut reader = std::io::BufReader::new(stdin.lock()); let mut writer = std::io::BufWriter::new(stdout.lock()); run(&mut reader, &mut writer); }