#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > adj[200005];
int n;
int dfs1(int i, int p) {
  int sum = 1;
  for (auto& j : adj[i]) {
    if (j.first != p) {
      j.second = dfs1(j.first, i);
      sum += j.second;
    }
  }
  return sum;
}
int dfs2(int i, int p) {
  for (auto j : adj[i]) {
    if (j.first != p && !(j.second & 1)) {
      dfs2(j.first, i);
    }
  }
  cout << i << '\n';
  for (auto j : adj[i]) {
    if (j.first != p && (j.second & 1)) {
      dfs2(j.first, i);
    }
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int q;
    cin >> q;
    if (q) {
      adj[i].push_back(make_pair(q, 0));
      adj[q].push_back(make_pair(i, 0));
    }
  }
  if (!(n & 1)) cout << "NO\n", exit(0);
  cout << "YES\n";
  dfs1(1, 0);
  dfs2(1, 0);
}
