#include <bits/stdc++.h>
using namespace std;
int n;
int p[2000010], d[2000010];
vector<int> ord;
vector<int> a[2000010];
void dfs(int u) {
  for (auto v : a[u]) {
    dfs(v);
  }
  ord.push_back(u);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  int root = 0;
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
    d[p[i]]++;
    if (p[i])
      d[i]++;
    else
      root = i;
    a[p[i]].push_back(i);
  }
  dfs(root);
  vector<int> even, odd;
  for (auto i : ord) {
    if (d[i] % 2) {
      if (i == root) {
        cout << "NO\n";
        return 0;
      }
      odd.push_back(i);
    } else {
      even.push_back(i);
      d[p[i]]--;
    }
  }
  reverse(odd.begin(), odd.end());
  even.insert(even.end(), odd.begin(), odd.end());
  cout << "YES\n";
  for (auto el : even) {
    cout << el << " ";
  }
  cout << "\n";
  return 0;
}
