import sys input=lambda:sys.stdin.readline().rstrip() N=int(input()) temp=input().split() A=[[int(temp[i]),i] for i in range(N-1)] A=sorted(A,key=lambda x:x[0]) ans=[0 for i in range(N-1)] for i in range(N-1): ans[A[i][1]]=i-A[i][0]+2 if min(ans)<1: print('NO') else: print('YES') for i in ans: print(i)