#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-5;
const int oo = (int)1e8;
template <class T>
inline void checkmin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void checkmax(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline T lowbit(T n) {
  return (n ^ (n - 1)) & n;
}
template <class T>
inline int countbit(T n) {
  return (n == 0) ? 0 : (1 + countbit(n & (n - 1)));
}
template <class T>
inline T gcd(T a, T b) {
  T c;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
template <class T>
inline T mabs(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
typedef vector<int> VI;
typedef vector<VI> VII;
typedef vector<string> VS;
#pragma comment(linker, "/STACK:36777216")
int TEST_TO;
int TEST_FROM;
const int N = (int)23;
int a[N], b[N], ord[N];
pair<int, int> aa[N];
inline bool ok(int n) {
  for (int i = (1); i < int((1 << (n)) - 1); i++) {
    long long as = 0, bs = 0;
    for (int j = (0); j < int(n); j++)
      if ((i & (1 << (j))) > 0) {
        as += a[j];
        bs += b[j];
      }
    if (as == bs) {
      return false;
    }
  }
  return true;
}
inline int solve(int testnum) {
  int n;
  scanf("%d", &n);
  memset(b, -1, sizeof(b));
  memset(ord, -1, sizeof(ord));
  for (int i = (0); i < int(n); i++) {
    scanf("%d", a + i);
    aa[i] = make_pair(a[i], i);
  }
  sort(aa, aa + n);
  for (int i = (0); i < int(n); i++) b[aa[(i + 1) % n].second] = aa[i].first;
  for (int i = (0); i < int(n); i++)
    printf("%d%s", b[i], (i == n - 1 ? "\n" : " "));
  return 0;
}
void gen() {
  srand(time(NULL));
  for (int _t = (1); _t < int(100); _t++) {
    int n = 1 + rand() % 22;
    int maxl = (int)1e9;
    printf("%d\n", n);
    for (int i = (1); i < int(n + 1); i++) {
      int a = rand() % maxl;
      printf("%d%s", a, (i == n ? "\n" : " "));
    }
    cerr << "Test " << _t << endl;
  }
}
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  int t = 1;
  if (argc > 1) t = atoi(argv[1]);
  TEST_FROM = 1;
  TEST_TO = t;
  for (int _t = (1); _t < int(t + 1); _t++) {
    int ret = solve(_t);
    if (ret == -1) break;
    cerr << "Solved test " << _t << endl;
  }
  return 0;
}

### Prompt

Please provide a Cpp coded solution to the problem described below:

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;
const double pi = acos(-1.0);
const double eps = 1e-5;
const int oo = (int)1e8;
template <class T>
inline void checkmin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void checkmax(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline T lowbit(T n) {
  return (n ^ (n - 1)) & n;
}
template <class T>
inline int countbit(T n) {
  return (n == 0) ? 0 : (1 + countbit(n & (n - 1)));
}
template <class T>
inline T gcd(T a, T b) {
  T c;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
template <class T>
inline T mabs(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
typedef vector<int> VI;
typedef vector<VI> VII;
typedef vector<string> VS;
#pragma comment(linker, "/STACK:36777216")
int TEST_TO;
int TEST_FROM;
const int N = (int)23;
int a[N], b[N], ord[N];
pair<int, int> aa[N];
inline bool ok(int n) {
  for (int i = (1); i < int((1 << (n)) - 1); i++) {
    long long as = 0, bs = 0;
    for (int j = (0); j < int(n); j++)
      if ((i & (1 << (j))) > 0) {
        as += a[j];
        bs += b[j];
      }
    if (as == bs) {
      return false;
    }
  }
  return true;
}
inline int solve(int testnum) {
  int n;
  scanf("%d", &n);
  memset(b, -1, sizeof(b));
  memset(ord, -1, sizeof(ord));
  for (int i = (0); i < int(n); i++) {
    scanf("%d", a + i);
    aa[i] = make_pair(a[i], i);
  }
  sort(aa, aa + n);
  for (int i = (0); i < int(n); i++) b[aa[(i + 1) % n].second] = aa[i].first;
  for (int i = (0); i < int(n); i++)
    printf("%d%s", b[i], (i == n - 1 ? "\n" : " "));
  return 0;
}
void gen() {
  srand(time(NULL));
  for (int _t = (1); _t < int(100); _t++) {
    int n = 1 + rand() % 22;
    int maxl = (int)1e9;
    printf("%d\n", n);
    for (int i = (1); i < int(n + 1); i++) {
      int a = rand() % maxl;
      printf("%d%s", a, (i == n ? "\n" : " "));
    }
    cerr << "Test " << _t << endl;
  }
}
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  int t = 1;
  if (argc > 1) t = atoi(argv[1]);
  TEST_FROM = 1;
  TEST_TO = t;
  for (int _t = (1); _t < int(t + 1); _t++) {
    int ret = solve(_t);
    if (ret == -1) break;
    cerr << "Solved test " << _t << endl;
  }
  return 0;
}

```