lib C fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64 end class String def to_i64 C.strtoll(self, nil, 10) end end n = read_line.to_i a = read_line.split.map(&.to_i).each_with_index.to_a.sort ans = [0] * ~-n (0...n - 1).each do |i| if i + 1 < a[i][0] puts "NO" exit end ans[a[i][1]] = i + 2 - a[i][0] end puts "YES", ans.join('\n')