#include <bits/stdc++.h>
using namespace std;
std::vector<long long int> aarr;
bool visited[200005];
std::vector<long long int> v[200005];
long long int root;
void dfs2(long long int s) {
  if (visited[s]) return;
  visited[s] = true;
  aarr.push_back(s);
  for (long long int i = 0; i < v[s].size(); ++i) {
    dfs2(v[s][i]);
  }
}
void dfs(long long int s) {
  long long int deg = 0;
  if (s != root) deg++;
  for (long long int i = 0; i < v[s].size(); ++i) {
    dfs(v[s][i]);
    if (!visited[v[s][i]]) deg++;
  }
  if (deg % 2 == 0) dfs2(s);
}
int main() {
  long long int n, a, b, c, t;
  cin >> n;
  long long int p[n + 1], cnt = 0;
  memset(visited, 0, sizeof(visited));
  for (long long int i = 1; i <= n; i++) {
    cin >> p[i];
    if (p[i] != 0) {
      cnt++;
      v[p[i]].push_back(i);
    } else {
      root = i;
    }
  }
  if (cnt % 2 != 0) {
    cout << "NO\n";
    return 0;
  }
  dfs(root);
  cout << "YES\n";
  for (long long int i = 0; i < aarr.size(); i++) {
    cout << aarr[i] << endl;
  }
}
