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>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int INF = ~(1 << 31);
const double pi = acos(-1);
const double EPS = 1e-9;
template <class T>
T smod(T a, T b) {
  return (a % b + b) % b;
}
const int cs = 25 * 50000;
int n;
int tts = 0;
vector<vector<bitset<cs + 1>>> M;
int main() {
  cin.sync_with_stdio(false);
  cin >> n;
  vector<int> B, C, A(2 * n);
  for (int i = (0); i < (2 * n); i++) cin >> A[i];
  sort(A.begin(), A.end());
  for (int i = (2); i < (2 * n); i++) tts += A[i];
  B.push_back(A[0]);
  C.push_back(A[1]);
  A.erase(A.begin());
  A.erase(A.begin());
  for (int i = (0); i < (49); i++) {
    vector<bitset<cs + 1>> LE;
    for (int j = (0); j < (25); j++) {
      bitset<cs + 1> L;
      LE.push_back(L);
    }
    M.push_back(LE);
  }
  M[0][0].set(0, 1);
  for (int i = 0; i < n * 2 - 2; i++) {
    for (int g = 0; g < 25; g++) {
      for (int sm = 0; sm <= cs; sm++) {
        if (M[i][g].test(sm)) {
          M[i + 1][g].set(sm, 1);
          if (g + 1 <= 24 && sm + A[i] <= 25 * cs) {
            M[i + 1][g + 1].set(sm + A[i], 1);
          }
        }
      }
    }
  }
  int mn = 100000000;
  int val = 0;
  for (int sm = 0; sm <= cs; sm++) {
    if (M[2 * n - 2][n - 1].test(sm)) {
      int oth = tts - sm;
      if (abs(oth - sm) < mn) {
        mn = min(mn, abs(oth - sm));
        val = sm;
      }
    }
  }
  int at = n * 2 - 2;
  int g = n - 1;
  int sm = val;
  while (at != 0) {
    if (g - 1 >= 0 && sm - A[at - 1] >= 0 &&
        M[at - 1][g - 1].test(sm - A[at - 1])) {
      B.push_back(A[at - 1]);
      sm -= A[at - 1];
      at -= 1;
      g -= 1;
    } else {
      C.push_back(A[at - 1]);
      at -= 1;
    }
  }
  sort(B.begin(), B.end());
  sort(C.rbegin(), C.rend());
  for (auto it = (B).begin(); it != (B).end(); ++it) cout << *it << " ";
  cout << endl;
  for (auto it = (C).begin(); it != (C).end(); ++it) cout << *it << " ";
  cout << endl;
  return 0;
}