use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let a: Vec = (0..n - 1) .map(|_| itr.next().unwrap().parse().unwrap()) .collect(); let mut b = Vec::new(); for i in 0..n - 1 { b.push((a[i], i)); } b.sort(); let mut ans = vec![0; n - 1]; let mut now = 1; let mut ok = true; for &(v, i) in b.iter() { // v-1 > if now > v - 1 { ans[i] = now - (v - 1); now += 1; } else { ok = false; break; } } if ok { println!("YES"); for &b in ans.iter() { println!("{}", b); } } else { println!("NO") } }