#include <bits/stdc++.h>
using namespace std;
vector<int> g[200005];
int sz[200005];
void init(int node) {
  sz[node] = 1;
  for (auto it : g[node]) {
    init(it);
    sz[node] = sz[node] + sz[it];
  }
}
void dfs(int node) {
  for (auto it : g[node]) {
    if (!(sz[it] & 1)) dfs(it);
  }
  cout << node << "\n";
  for (auto it : g[node]) {
    if (sz[it] & 1) dfs(it);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, i, pi, r;
  cin >> n;
  if (!(n & 1)) {
    cout << "NO\n";
    return 0;
  }
  for (i = 1; i <= n; i++) {
    cin >> pi;
    if (pi == 0)
      r = i;
    else
      g[pi].push_back(i);
  }
  init(r);
  cout << "YES\n";
  dfs(r);
  return 0;
}
