#include #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define all(c) c.begin(),c.end() #define pb push_back #define fs first #define sc second #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) using namespace std; template ostream& operator<<(ostream& o,const pair &p){ return o<<"("< ostream& operator<<(ostream& o,const vector &vc){ o<<"{"; for(const T& v:vc) o< using V = vector; template using VV = vector>; constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); } #ifdef LOCAL #define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl #define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {"; \ for(auto v: x) cerr << v << ","; cerr << "}" << endl; #else #define show(x) true #define dump(x) true #endif int main(){ cin.tie(0); ios::sync_with_stdio(false); //DON'T USE scanf/printf/puts !! cout << fixed << setprecision(20); int N; cin >> N; V p(N),where(N); set st; rep(i,N) st.insert(i); rep(i,N){ cin >> p[i], p[i]--; where[p[i]] = i; } V ans; rep(i,N){ int x = where[i]; if(*st.begin() == x){ for(int v: st) if(v != x){ ans.pb(p[v]); } break; } if(*st.rbegin() == x){ cout << "No" << endl; return 0; } ans.pb(i); st.erase(x); } cout << "Yes" << endl; for(int x: ans) cout << x+1 << " "; cout << endl; }