Niwango has N cards, numbered 1,2,\ldots,N. He will now arrange these cards in a row.

Niwango wants to know if there is a way to arrange the cards while satisfying all the N conditions below. To help him, determine whether such a way exists. If the answer is yes, also find the lexicographically smallest such arrangement.

* To the immediate right of Card 1 (if any) is NOT Card a_1.
* To the immediate right of Card 2 (if any) is NOT Card a_2.
* \vdots
* To the immediate right of Card N (if any) is NOT Card a_N.

Constraints

* 2 \leq N \leq 10^{5}
* 1 \leq a_i \leq N
* a_i \neq i

Input

Input is given from Standard Input in the following format:


N
a_1 a_2 \ldots a_N


Output

If no arrangements satisfy the conditions, print `-1`. If such arrangements exist, print the lexicographically smallest such arrangement, in the following format:


b_1 b_2 \ldots b_N


Here, b_i represents the i-th card from the left.

Examples

Input

4
2 3 4 1


Output

1 3 2 4


Input

2
2 1


Output

-1


Input

13
2 3 4 5 6 7 8 9 10 11 12 13 12


Output

1 3 2 4 6 5 7 9 8 10 12 11 13
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class DArrangement {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      if (n==2) {
        cout << -1 << endl;
        return;
      }

      vector<int> a(n+1);
      vector<int> cnt(n+1);
      for(int i=1; i<=n; i++) {
        cin >> a[i];
        cnt[a[i]]++;
      }

      set<int> st;
      for(int i=1; i<=n; i++) {
        st.insert(i);
      }

      priority_queue<P> que;
      for(int i=1; i<=n; i++) {
        que.emplace(cnt[i], i);
      }

      vector<int> b(n);
      for(int i=0; i<n-3; i++) {
        auto it = st.begin();
        if (i > 0 && a[b[i-1]] == *it) ++it;
        b[i] = *it;

        while (que.top().first >= n-1-i) {
          if (st.find(que.top().second) == st.end()) {
            // already removed
            que.pop();
            continue;
          } else if (que.top().first != cnt[que.top().second]) {
            // update
            que.pop();
            que.emplace(cnt[que.top().second], que.top().second);
            continue;
          }
          b[i] = que.top().second;
          que.pop();
          break;
        }

        st.erase(b[i]);
        cnt[a[b[i]]]--;
      }

      // brute-force search
      vector<int> vec;
      for(auto e: st) {
        vec.push_back(e);
      }

      do {
        b[n-3] = vec[0];
        b[n-2] = vec[1];
        b[n-1] = vec[2];
        if (a[b[n-4]] != b[n-3] && a[b[n-3]] != b[n-2] && a[b[n-2]] != b[n-1]) {
          for(auto e: b) {
            cout << e << ' ';
          }
          cout << endl;
          return;
        }
      } while (next_permutation(all(vec)));
    }
};

signed main() {
  DArrangement solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}