#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # %% N, *A = map(int, read().split()) # %% if A[0] > A[-1]: print('No') exit() # %% rest = [A[0]] remove = [] for x in A[1:-1]: if x > rest[-1]: remove.append(x) else: rest.append(x) # %% for x in rest[::-1]: remove.append(x) # %% print('Yes') print(' '.join(map(str, remove)))