#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > tree;
vector<int> stopnie;
vector<int> dist;
vector<int> ans;
vector<bool> deleted;
bool bad = false;
void clearDown(int cur, int p) {
  if (stopnie[cur] % 2 == 1) {
    bad = true;
  }
  ans.push_back(cur);
  deleted[cur] = true;
  for (auto a : tree[cur]) {
    if (a != p && deleted[a] == false) {
      stopnie[a]--;
      clearDown(a, cur);
    }
  }
}
void dfs(int cur, int p) {
  for (auto a : tree[cur]) {
    if (a == p) continue;
    dfs(a, cur);
  }
  if (stopnie[cur] % 2 == 0) {
    ans.push_back(cur);
    deleted[cur] = true;
    stopnie[cur] = 0;
    for (auto a : tree[cur]) {
      if (deleted[a] == true) continue;
      stopnie[a]--;
      if (a != p) clearDown(a, cur);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  tree.resize(n);
  stopnie.resize(n);
  dist.resize(n);
  deleted.resize(n);
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (a > 0) {
      tree[i].push_back(a - 1);
      tree[a - 1].push_back(i);
      stopnie[i]++;
      stopnie[a - 1]++;
    }
  }
  if (n == 1) {
    cout << "YES\n1\n";
    return 0;
  }
  if (n == 2) {
    cout << "NO\n";
    return 0;
  }
  int root = 0;
  for (int i = 0; i < n; i++)
    if (stopnie[i] > 1) root = i;
  dfs(root, -1);
  for (auto a : deleted)
    if (a == false) bad = true;
  if (bad == true) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    for (auto a : ans) cout << a + 1 << "\n";
    cout << endl;
  }
}
