#include <bits/stdc++.h>
using namespace std;
int addnum, vel[410000], ne[410000], head[410000];
int addedgenum, vet[410000], nex[410000], last[410000];
int siz[210000], fa[210000], q[210000], du[210000];
int n, he, ta;
void add(int u, int v) {
  addnum++;
  vel[addnum] = v;
  ne[addnum] = head[u];
  head[u] = addnum;
}
void addedge(int u, int v) {
  du[v]++;
  addedgenum++, vet[addedgenum] = v;
  nex[addedgenum] = last[u];
  last[u] = addedgenum;
}
void getsize(int x, int fa) {
  siz[x] = 1;
  for (int e = head[x]; e; e = ne[e]) {
    int v = vel[e];
    if (v == fa) continue;
    getsize(v, x);
    siz[x] += siz[v];
  }
}
int main() {
  scanf("%d", &n);
  if (n % 2) {
    printf("YES\n");
    for (int i = 1; i <= n; i++) {
      scanf("%d", &fa[i]);
      if (fa[i] != 0) add(fa[i], i), add(i, fa[i]);
    }
    for (int i = 1; i <= n; i++)
      if (!fa[i]) getsize(i, -1);
    for (int i = 1; i <= n; i++)
      if (fa[i] != 0) {
        if (siz[i] % 2)
          addedge(fa[i], i);
        else
          addedge(i, fa[i]);
      }
    for (int i = 1; i <= n; i++)
      if (!du[i]) q[++ta] = i;
    while (he < ta) {
      int u = q[++he];
      for (int e = last[u]; e; e = nex[e]) {
        int v = vet[e];
        du[v]--;
        if (!du[v]) q[++ta] = v;
      }
    }
    for (int i = 1; i <= n; i++) printf("%d\n", q[i]);
  } else
    printf("NO\n");
}
