#include <bits/stdc++.h>
using namespace std;
int done[200005], deg[200005];
vector<int> adj[200005];
void dfs(int node, int par) {
  int x = 0, y = 0;
  for (int child : adj[node]) {
    if (child == par) continue;
    dfs(child, node);
    if (done[child])
      x++;
    else
      y++;
  }
  if ((deg[node] - x) % 2 == 0) {
    done[node] = 1;
  }
}
void doit(int node, int par) {
  for (int child : adj[node]) {
    if (child == par) continue;
    if (done[child]) doit(child, node);
  }
  printf("%d\n", node);
  for (int child : adj[node]) {
    if (child == par) continue;
    if (!done[child]) doit(child, node);
  }
}
int main() {
  int n, p;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p);
    adj[p].push_back(i);
    if (p) {
      adj[i].push_back(p);
    }
  }
  for (int i = 1; i <= n; i++) {
    deg[i] = adj[i].size();
  }
  dfs(adj[0][0], 0);
  if (!done[adj[0][0]])
    printf("NO\n");
  else {
    printf("YES\n");
    doit(adj[0][0], 0);
  }
  return 0;
}
