#include <bits/stdc++.h>
using namespace std;
int n;
vector<vector<int> > v;
int root;
vector<int> deleted;
vector<int> taken;
void dd(int s) {
  if (deleted[s]) return;
  deleted[s] = 1;
  taken.push_back(s);
  for (int i = 0; i < v[s].size(); i++) dd(v[s][i]);
}
bool dfs(int x) {
  int edges = 0;
  if (x != root) edges++;
  for (int i = 0; i < v[x].size(); i++) {
    if (!dfs(v[x][i]) && !deleted[v[x][i]]) edges++;
  }
  if (edges % 2 == 0) {
    dd(x);
    return 1;
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  v.resize(n + 1);
  deleted.resize(n + 1);
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (x != 0) {
      v[x].push_back(i);
    } else {
      root = i;
    }
  }
  if (dfs(root) == 0) {
    cout << "NO";
    return 0;
  }
  cout << "YES" << endl;
  for (int i = 0; i < taken.size(); i++) {
    cout << taken[i] << endl;
  }
  return 0;
}
