lib C fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64 end class String def to_i64 C.strtoll(self, nil, 10) end end n = read_line.to_i a = read_line.split.map(&.to_i) if a[0] < a[-1] puts "Yes" ans = [] of Int32 (1..n - 2).each do |i| ans << a[i] if a[0] < a[i] end (1..n - 2).reverse_each do |i| ans << a[i] if a[i] < a[0] end ans << a[0] puts ans.join(' ') else puts "No" end