#include using namespace std; int main() { int n; cin >> n; vector a(n); for (auto&& e : a) cin >> e; if (a[0] > a.back()) { cout << "No\n"; return 0; } cout << "Yes\n"; for (int i = n - 2; i >= 0; --i) { if (a[i] < a[0]) { cout << a[i] << ' '; } } for (int i = 1; i < n - 1; ++i) { if (a[i] > a[0]) { cout << a[i] << ' '; } } cout << a.back() << '\n'; }