#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > AdjList;
const int maxn = 2e5 + 5;
vector<int> listIdx;
int jumlahTotalNode[maxn];
int countTotalNode(int node, int parent) {
  int ans = 1;
  for (int i = 0; i < AdjList[node].size(); i++) {
    int v = AdjList[node][i];
    if (v != parent) {
      ans += countTotalNode(v, node);
    }
  }
  return jumlahTotalNode[node] = ans;
}
void dfs(int node, int parent) {
  int i, j;
  for (i = 0; i < AdjList[node].size(); i++) {
    int v = AdjList[node][i];
    if (v != parent) {
      if (jumlahTotalNode[v] % 2 == 0) {
        dfs(v, node);
      }
    }
  }
  listIdx.push_back(node);
  for (i = 0; i < AdjList[node].size(); i++) {
    int v = AdjList[node][i];
    if (v != parent) {
      if (jumlahTotalNode[v] % 2 == 1) {
        dfs(v, node);
      }
    }
  }
}
int main() {
  int n, i, j;
  scanf("%d", &n);
  AdjList.assign(n + 3, vector<int>());
  int idxRoot = 0;
  for (i = 1; i <= n; i++) {
    int parent;
    scanf("%d", &parent);
    if (parent == 0) {
      idxRoot = i;
      continue;
    }
    AdjList[parent].push_back(i);
    AdjList[i].push_back(parent);
  }
  if (n % 2 == 0) {
    printf("NO\n");
    return 0;
  }
  countTotalNode(idxRoot, 0);
  dfs(idxRoot, 0);
  printf("YES\n");
  for (i = 0; i < listIdx.size(); i++) {
    printf("%d\n", listIdx[i]);
  }
  return 0;
};
