n = int(input()) *a, = map(int,input().split()) res = [] for i in range(1,n): if a[0]==i: res += a[1:] break elif a[-1]==i: break else: a.pop(a.index(i)) res.append(i) if len(res) < n-1: print("No") else: print("Yes") print(*res)