/** * author: ivanzuki * created: Tue May 11 2021 **/ #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; --a[i]; } vector st = {a[0]}; vector ans; for (int i = 1; i < n; i++) { while (st.size() > 1 && st.back() < a[i]) { ans.push_back(st.back()); st.pop_back(); } if (st.size() == 1 && st.back() < a[i]) { ans.push_back(a[i]); } else { st.push_back(a[i]); } } if (st.size() == 1) { assert((int) ans.size() == n - 1); cout << "Yes" << '\n'; for (const auto& x : ans) { cout << x + 1 << ' '; } cout << '\n'; } else { cout << "No" << '\n'; } return 0; }