#include <bits/stdc++.h>
using namespace std;
int n, p[200001], count_child[200001];
vector<int> adj[200001], comb;
bool visited[200001], del[200001], visited2[200001];
void setup() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int temp;
    cin >> temp;
    if (temp) {
      adj[temp].push_back(i);
      adj[i].push_back(temp);
    }
  }
}
void dfs2(int t) {
  visited2[t] = true;
  if (!del[t]) comb.push_back(t);
  for (int i : adj[t]) {
    if (!visited2[i] && i != p[t]) {
      dfs2(i);
    }
  }
}
void dfs(int t) {
  visited[t] = true;
  for (int i : adj[t]) {
    if (!visited[i]) {
      p[i] = t;
      dfs(i);
      if (!del[i]) count_child[t]++;
    }
  }
  if (count_child[t] & 1 || (t == 1 && count_child[t] % 2 == 0)) {
    del[t] = true;
    comb.push_back(t);
    dfs2(t);
  }
}
void process() {
  dfs(1);
  if (count_child[1] & 1) {
    cout << "NO";
    return;
  }
  cout << "YES\n";
  for (int i : comb) cout << i << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  setup();
  process();
  return 0;
}
