#include using namespace std; typedef long long ll; signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20); int n; cin>>n; int a[n]; for(int i=0;i>a[i]; } vector ans; int now = a[0]; stack st; st.push(a[0]); for(int i=1;i a[i]) break; ans.push_back(now); now = st.top(); st.pop(); if(now == a[0]) st.push(a[0]); } ans.push_back(a[i]); } else{ st.push(now); now = a[i]; } } if(ans.size()==n-1){ cout << "Yes\n"; for(auto i:ans){ cout << i << " "; } cout << "\n"; return 0; } cout << "No\n"; }