#include using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } if (a.front() > a.back()) { cout << "No\n"; return 0; } cout << "Yes\n"; vector ans; for (int i = n - 2; i > 0; i--) { if (a.front() > a[i]) { ans.push_back(a[i]); } } for (int i = 0; i < n; i++) { if (a.front() < a[i]) { ans.push_back(a[i]); } } for (int i = 0; i < n - 1; i++) { cout << ans[i] << " \n"[i + 2 == n]; } return 0; }