N = gets.to_i a = gets.split.map(&:to_i) b = a.each_with_index.to_a.sort c = [] dp = [false] * N dp[0] = true b.each_with_index do |(l, j), i| x = i + 1 - l c[j] = x + 1 dp[i+1] = dp[x] if x >= 0 end if dp.all?(true) puts "YES" puts c else puts "NO" end