def main(): import sys input = sys.stdin.read().split() idx = 0 N = int(input[idx]) idx += 1 a = list(map(int, input[idx:idx + N - 1])) idx += N - 1 R = {1} current_max = 1 res = [] possible = True for ai in a: if (1 + ai) not in R: x = 1 res.append(x) new_node = x + ai R.add(new_node) if new_node > current_max: current_max = new_node else: x = current_max - ai + 1 if x < 1 or x > (N - ai): possible = False break if x not in R or (x + ai) in R: possible = False break res.append(x) new_node = x + ai R.add(new_node) if new_node > current_max: current_max = new_node if possible and len(R) == N: print("YES") for x in res: print(x) else: print("NO") if __name__ == "__main__": main()