import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio; void main() { auto N = readln.chomp.to!int; auto A = readln.split.map!(to!int).array; int[][] B; int tmp = 1 << 29; foreach (a; A) { if (a > tmp) { B.back ~= a; tmp = a; } else { B ~= [a]; tmp = a; } } if (B.length > 1 && B[0..$-1].map!(b => b.front > B.back.back).any) { writeln("No"); return; } writeln("Yes"); int[] ans; foreach (i; 0..B.length.to!int-1) { foreach (j; 1..B[i].length) { write(B[i][j], " "); } } foreach_reverse (i; 0..B.back.length.to!int-1) { write(B.back[i], " "); } foreach_reverse (i; 0..B.length.to!int-1) { write(B[i].front, " "); } writeln; }