#include <bits/stdc++.h>
using namespace std;
vector<int> v[200010], g;
int vis[200010];
int root, sum;
void Check(int r) {
  if (vis[r]) return;
  vis[r] = 1;
  g.push_back(r);
  int sz = v[r].size();
  for (int i = 0; i < sz; i++) Check(v[r][i]);
}
void Dfs(int r) {
  int sz = v[r].size();
  int deg = 0;
  if (r != root) deg++;
  for (int i = 0; i < sz; i++) {
    Dfs(v[r][i]);
    if (!vis[v[r][i]]) deg++;
  }
  if (!(deg & 1)) Check(r);
}
int main() {
  int n, b;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> b;
    if (b == 0)
      root = i;
    else
      v[b].push_back(i);
  }
  Dfs(root);
  int sz = g.size();
  if (sz == n) {
    cout << "YES" << endl;
    for (int i = 0; i < sz; i++) cout << g[i] << endl;
  } else
    cout << "NO" << endl;
  return 0;
}
