Problem: Kolya has a turtle and a field of size 2 × n. The field rows are numbered from 1 to 2 from top to bottom, while the columns are numbered from 1 to n from left to right.

Suppose in each cell of the field there is a lettuce leaf. The energy value of lettuce leaf in row i and column j is equal to a_{i,j}. The turtle is initially in the top left cell and wants to reach the bottom right cell. The turtle can only move right and down and among all possible ways it will choose a way, maximizing the total energy value of lettuce leaves (in case there are several such paths, it will choose any of them).

Kolya is afraid, that if turtle will eat too much lettuce, it can be bad for its health. So he wants to reorder lettuce leaves in the field, so that the energetic cost of leaves eaten by turtle will be minimized.

Input

The first line contains an integer n (2 ≤ n ≤ 25) — the length of the field.

The second line contains n integers a_{1, i} (0 ≤ a_{1, i} ≤ 50 000), the energetic cost of lettuce leaves in the first row of the field.

The third line contains n integers a_{2, i} (0 ≤ a_{2, i} ≤ 50 000), the energetic cost of lettuce leaves in the second row of the field.

Output

Print two lines with n integers in each — the optimal reordering of lettuce from the input data.

In case there are several optimal ways to reorder lettuce, print any of them.

Examples

Input


2
1 4
2 3


Output


1 3 
4 2 


Input


3
0 0 0
0 0 0


Output


0 0 0 
0 0 0 


Input


3
1 0 1
0 0 0


Output


0 0 1
0 1 0

Note

In the first example, after reordering, the turtle will eat lettuce with total energetic cost 1+4+2 = 7.

In the second example, the turtle will eat lettuce with energetic cost equal 0.

In the third example, after reordering, the turtle will eat lettuce with total energetic cost equal 1.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int maxn = 500 + 2;
const int INF = 0x3f3f3f3f;
int n, a[maxn], Ans[3][maxn], s1, s2, m, b[maxn], sum1, sum2, sum;
vector<pair<int, int> > lis[2][maxn];
inline void prepare(int *a, int kd) {
  for (int i = 0; i < (1 << m); i++) {
    if (i == 16777215) {
      int xx;
      xx++;
    }
    int bit = 0, sum = 0;
    for (int j = 1; j <= m; j++) {
      if (i & (1 << (j - 1))) {
        bit++;
        sum += a[j];
      }
    }
    lis[kd][bit].push_back(make_pair(sum, i));
  }
  for (int i = 0; i <= m; i++) sort(lis[kd][i].begin(), lis[kd][i].end());
}
int ans, ans1, ans2;
inline void Updata(pair<int, int> a, pair<int, int> b) {
  int now = max(s1 + a.first + b.first + s2, sum - a.first - b.first);
  if (now >= ans) return;
  ans = now;
  ans1 = a.second;
  ans2 = b.second;
}
inline void Merge(vector<pair<int, int> > &a, vector<pair<int, int> > &b) {
  int Sz1 = a.size(), Sz2 = b.size();
  for (int i = 0, j = Sz2 - 1; i < Sz1; i++) {
    while (j > 0 && 2 * (a[i].first + b[j - 1].first) + s1 + s2 >= sum) j--;
    Updata(a[i], b[j]);
    if (j > 0) Updata(a[i], b[j - 1]);
  }
}
int main() {
  scanf("%d", &n);
  int _n = n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i + n]);
  n <<= 1;
  sort(a + 1, a + n + 1);
  Ans[1][1] = a[1];
  Ans[2][n / 2] = a[2];
  s1 = a[1], s2 = a[2];
  for (int i = 1; i <= n - 2; i++) a[i] = a[i + 2];
  n -= 2;
  m = n / 2;
  for (int i = 1; i <= m; i++) b[i] = a[i + m];
  prepare(a, 0);
  prepare(b, 1);
  sum1 = sum2 = 0;
  for (int i = 1; i <= m; i++) sum1 += a[i];
  for (int i = 1; i <= m; i++) sum2 += b[i];
  sum = sum1 + sum2 + s1 + s2;
  ans = INF;
  for (int i = 0; i <= m; i++) {
    Merge(lis[0][i], lis[1][m - i]);
  }
  int cnt = 1;
  for (int i = 1; i <= m; i++) {
    if (ans1 & (1 << (i - 1))) Ans[1][++cnt] = a[i];
  }
  for (int i = 1; i <= m; i++) {
    if (ans2 & (1 << (i - 1))) Ans[1][++cnt] = b[i];
  }
  cnt = _n;
  for (int i = 1; i <= m; i++) {
    if (!(ans1 & (1 << (i - 1)))) Ans[2][--cnt] = a[i];
  }
  for (int i = 1; i <= m; i++) {
    if (!(ans2 & (1 << (i - 1)))) Ans[2][--cnt] = b[i];
  }
  int S[3], Scnt = 0;
  S[0] = S[1] = 0;
  for (int i = 1; i <= 2; i++) {
    for (int j = 1; j <= _n; j++)
      printf("%d ", Ans[i][j]), S[Scnt] += Ans[i][j];
    Scnt++;
    puts("");
  }
  return 0;
}