def main(): import sys input = sys.stdin.read().split() N = int(input[0]) a_list = list(map(int, input[1:N])) reachable = {1} SMN = 2 rightmost = 1 result = [] for a in a_list: # Try to add SMN if (SMN - a) in reachable and (SMN - a) >= 1: x = SMN - a result.append(x) reachable.add(SMN) # Update SMN while SMN <= N and SMN in reachable: SMN += 1 else: # Try to add rightmost + a new_node = rightmost + a if new_node > N or new_node in reachable: print("NO") return result.append(rightmost) reachable.add(new_node) rightmost = new_node # Check if new_node is SMN while SMN <= N and SMN in reachable: SMN += 1 if len(reachable) == N: print("YES") print('\n'.join(map(str, result))) else: print("NO") if __name__ == "__main__": main()