#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
vector<int> g[N], ans;
int n, done[N];
void fix(int u, int p) {
  ans.push_back(u + 1);
  done[u] = 1;
  for (auto i : g[u])
    if (i != p & !done[i]) fix(i, u);
}
bool dfs(int u, int p) {
  int even = p != -1;
  for (auto i : g[u])
    if (p != i) even ^= dfs(i, u);
  if (!even) fix(u, p);
  return even;
}
int main() {
  scanf("%d", &n);
  if (!(n & 1)) return puts("NO"), 0;
  for (int i = 0, a; i < n; i++) {
    scanf("%d", &a);
    if (a--) g[a].push_back(i), g[i].push_back(a);
  }
  dfs(0, -1);
  puts("YES");
  for (auto i : ans) printf("%d\n", i);
}
