import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } if (arr[0] >= arr[n - 1]) { System.out.println("No"); return; } StringBuilder sb = new StringBuilder("Yes\n"); for (int i = 1; i < n - 1; i++) { if (arr[0] < arr[i]) { sb.append(arr[i]).append(" "); arr[i] = Integer.MAX_VALUE; } } for (int i = n - 2; i > 1; i--) { if (arr[n - 1] > arr[i]) { sb.append(arr[i]).append(" "); } } sb.append(arr[n - 1]); System.out.println(sb); } }