#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
template <typename T>
void printV(const T &t) {
  std::copy(t.cbegin(), t.cend(),
            std::ostream_iterator<typename T::value_type>(std::cout, " "));
  cout << "\n";
}
template <typename T>
void printVV(const T &t) {
  for (int i = 0; i < t.size(); i++) {
    printf("%d: ", i);
    printV(t[i]);
  }
}
template <typename T, typename S>
void printVP(vector<pair<T, S>> vp) {
  if (vp.empty()) {
    cout << "\n";
    return;
  }
  for (int i = 0; i < vp.size() - 1; i++) {
    cout << "(" << vp[i].first << " " << vp[i].second << ") ";
  }
  cout << "(" << vp[vp.size() - 1].first << " " << vp[vp.size() - 1].second
       << ")\n";
}
template <typename T>
void printVVP(vector<vector<pair<T, T>>> vvp) {
  for (int i = 0; i < vvp.size(); i++) {
    cout << i << ": ";
    printVP(vvp[i]);
  }
}
vector<string> split(const string &s, char delim) {
  vector<string> result;
  stringstream ss(s);
  string item;
  while (getline(ss, item, delim)) {
    result.push_back(item);
  }
  return result;
}
bool is_number(const string &s) {
  string::const_iterator it = s.begin();
  while (it != s.end() && isdigit(*it)) ++it;
  return !s.empty() && it == s.end();
}
void fast() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
}
bool isValid(int r, int c, int R, int C) {
  return (r >= 0 && r < R && c >= 0 && c < C);
}
struct Can {
  long long x, r, id;
};
bool compareByX(const Can &lhs, const Can &rhs) { return lhs.x < rhs.x; }
class Person {
 public:
  string name, speak;
  unordered_set<string> understands;
  friend ostream &operator<<(ostream &os, const Person &p) {
    os << p.name << '(' << p.speak << "):";
    for (auto s : p.understands) os << " " << s;
    return os;
  }
};
vector<pair<int, int>> deltas = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
const int INF = 1e9 + 10;
const long long inf = 1e18 + 10;
const long double PI = 3.14159265359;
int main() {
  int N;
  cin >> N;
  vector<int> A(N), B(N);
  for (int i = 0; i < (N); ++i) {
    cin >> A[i];
    B[i] = A[i];
  }
  sort(B.begin(), B.end());
  unordered_map<int, int> m;
  for (int i = 0; i < (N); ++i) m[B[i]] = i;
  vector<int> C(N);
  for (int i = 0; i < (N); ++i) {
    C[i] = B[(m[A[i]] + 1) % N];
  }
  printV(C);
}

### Prompt

Please create a solution in CPP to the following problem:

You are given an array a with n distinct integers. Construct an array b by permuting a such that for every non-empty subset of indices S = {x1, x2, ..., xk} (1 ≤ xi ≤ n, 0 < k < n) the sums of elements on that positions in a and b are different, i. e. 

<image>

Input

The first line contains one integer n (1 ≤ n ≤ 22) — the size of the array.

The second line contains n space-separated distinct integers a1, a2, ..., an (0 ≤ ai ≤ 109) — the elements of the array.

Output

If there is no such array b, print -1.

Otherwise in the only line print n space-separated integers b1, b2, ..., bn. Note that b must be a permutation of a.

If there are multiple answers, print any of them.

Examples

Input

2
1 2


Output

2 1 


Input

4
1000 100 10 1


Output

100 1 1000 10

Note

An array x is a permutation of y, if we can shuffle elements of y such that it will coincide with x.

Note that the empty subset and the subset containing all indices are not counted.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
template <typename T>
void printV(const T &t) {
  std::copy(t.cbegin(), t.cend(),
            std::ostream_iterator<typename T::value_type>(std::cout, " "));
  cout << "\n";
}
template <typename T>
void printVV(const T &t) {
  for (int i = 0; i < t.size(); i++) {
    printf("%d: ", i);
    printV(t[i]);
  }
}
template <typename T, typename S>
void printVP(vector<pair<T, S>> vp) {
  if (vp.empty()) {
    cout << "\n";
    return;
  }
  for (int i = 0; i < vp.size() - 1; i++) {
    cout << "(" << vp[i].first << " " << vp[i].second << ") ";
  }
  cout << "(" << vp[vp.size() - 1].first << " " << vp[vp.size() - 1].second
       << ")\n";
}
template <typename T>
void printVVP(vector<vector<pair<T, T>>> vvp) {
  for (int i = 0; i < vvp.size(); i++) {
    cout << i << ": ";
    printVP(vvp[i]);
  }
}
vector<string> split(const string &s, char delim) {
  vector<string> result;
  stringstream ss(s);
  string item;
  while (getline(ss, item, delim)) {
    result.push_back(item);
  }
  return result;
}
bool is_number(const string &s) {
  string::const_iterator it = s.begin();
  while (it != s.end() && isdigit(*it)) ++it;
  return !s.empty() && it == s.end();
}
void fast() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
}
bool isValid(int r, int c, int R, int C) {
  return (r >= 0 && r < R && c >= 0 && c < C);
}
struct Can {
  long long x, r, id;
};
bool compareByX(const Can &lhs, const Can &rhs) { return lhs.x < rhs.x; }
class Person {
 public:
  string name, speak;
  unordered_set<string> understands;
  friend ostream &operator<<(ostream &os, const Person &p) {
    os << p.name << '(' << p.speak << "):";
    for (auto s : p.understands) os << " " << s;
    return os;
  }
};
vector<pair<int, int>> deltas = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
const int INF = 1e9 + 10;
const long long inf = 1e18 + 10;
const long double PI = 3.14159265359;
int main() {
  int N;
  cin >> N;
  vector<int> A(N), B(N);
  for (int i = 0; i < (N); ++i) {
    cin >> A[i];
    B[i] = A[i];
  }
  sort(B.begin(), B.end());
  unordered_map<int, int> m;
  for (int i = 0; i < (N); ++i) m[B[i]] = i;
  vector<int> C(N);
  for (int i = 0; i < (N); ++i) {
    C[i] = B[(m[A[i]] + 1) % N];
  }
  printV(C);
}

```