#include <iostream>
#include <map>
using namespace std;
const int N = 100010;
int n, m, maxn;
map<int, int> k;
bool vis[N];
int main() {
cin >> n;
for (int i = 1, x; i <= n; i ++ ) {
cin >> x;
m += (!k[x]);
k[x] ++ ;
maxn = max(maxn, x);
}
if (m & 1) {
cout << -1 << endl;
return 0;
}
for (auto& pair : k) {
if (!vis[pair.first]) {
bool b = true;
int a1 = pair.first, a2 = pair.second;
vis[a1] = true;
for (auto& pairr : k) {
int b1 = pairr.first, b2 = pairr.second;
if (!vis[b1]) {
if (a2 == b2) {
for (int i = 1; i <= a2; i ++ )
cout << a1 << " " << b1 << " ";
vis[b1] = true, b = !b;
break;
} else if (a2 & 1 && b2 & 1) {
cout << a1 << " " << b1 << " ";
for (int i = 1; i < a2; i ++ )
cout << a1 << " ";
for (int i = 1; i < b2; i ++ )
cout << b1 << " ";
vis[b1] = true, b = !b;
break;
}
}
}
if (b) {
cout << -1 << endl;
return 0;
}
}
}
return 0;
}