#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 2e5 + 10;
const int mod = 1e9 + 9;
int du[maxn];
vector<int> g[maxn];
int sz[maxn];
void dfs(int u, int f) {
  sz[u] = 1;
  for (int i = 0; i < g[u].size(); ++i) {
    int v = g[u][i];
    if (v == f) continue;
    dfs(v, u);
    sz[u] += sz[v];
  }
}
void print(int u, int f) {
  for (int i = 0; i < g[u].size(); ++i) {
    int v = g[u][i];
    if (v == f) continue;
    if (sz[v] % 2 == 0) print(v, u);
  }
  printf("%d\n", u);
  for (int i = 0; i < g[u].size(); ++i) {
    int v = g[u][i];
    if (v == f) continue;
    if (sz[v] % 2 == 1) print(v, u);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int root = -1;
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    if (x == 0)
      root = i;
    else {
      g[i].push_back(x);
      g[x].push_back(i);
    }
  }
  if (n & 1) {
    dfs(root, -1);
    printf("YES\n");
    print(root, -1);
  } else
    printf("NO\n");
}
