#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
vector<int> E[N];
vector<int> son[N];
int sz[N];
bool vis[N];
void DFS(int u) {
  sz[u] = 1;
  for (auto v : E[u]) {
    DFS(v);
    sz[u] += sz[v];
    if (sz[v] % 2 == 0) {
      son[u].push_back(v);
    }
  }
}
void Print(int u) {
  for (auto v : son[u]) {
    Print(v);
  }
  printf("%d\n", u);
  vis[u] = true;
  for (auto v : E[u]) {
    if (!vis[v]) Print(v);
  }
}
int main() {
  int n, x, root;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    if (x == 0) root = i;
    E[x].push_back(i);
  }
  if (n % 2 == 0) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  DFS(root);
  Print(root);
  return 0;
}
