#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1, ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
inline void writeln(int x) {
  write(x);
  puts("");
}
const int N = 2e5 + 5;
struct edge {
  int link, next;
} e[N << 1];
int n, head[N], tot, du[N];
inline void add_edge(int u, int v) {
  e[++tot] = (edge){v, head[u]};
  head[u] = tot;
}
inline void insert(int u, int v) {
  add_edge(u, v);
  add_edge(v, u);
}
inline void init() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int u = read();
    if (u) insert(u, i), du[i]++, du[u]++;
  }
}
bool mark[N];
int ans[N], cnt;
void dfs(int u, int fa, bool flag) {
  if (!flag) {
    for (int i = head[u]; i; i = e[i].next) {
      int v = e[i].link;
      if (v != fa && !mark[v]) {
        dfs(v, u, 0);
      }
    }
  }
  if (du[u] % 2 == 0) {
    du[u] = 0;
    ans[++cnt] = u;
    mark[u] = 1;
    for (int i = head[u]; i; i = e[i].next) {
      int v = e[i].link;
      --du[v];
      if (v != fa && !mark[v]) {
        dfs(v, u, 1);
      }
    }
  }
}
inline void solve() {
  dfs(1, 0, 0);
  if (cnt == n) {
    puts("YES");
    for (int i = 1; i <= n; i++) writeln(ans[i]);
  } else {
    puts("NO");
  }
}
int main() {
  init();
  solve();
  return 0;
}
