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 long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 25 * 50000 + 10;
const long long mod = 1e9 + 7;
const bool debug = false;
template <class T>
inline void add(T &x, long long y) {
  x += y;
  if (x >= mod) x -= mod;
}
template <class T>
inline void del(T &x, long long y) {
  x -= y;
  if (x < 0) x += mod;
}
template <class T>
inline void add(T &x, long long y, long long z) {
  x = y + z;
  if (x >= mod) x -= mod;
}
inline long long qpow(long long x, long long y) {
  x %= mod;
  long long ret = 1;
  while (y) {
    if (y & 1) ret = ret * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ret;
}
inline long long qmul(long long x, long long y, long long mod) {
  return ((x * y - (long long)((long double)x * y / mod) * mod) + mod) % mod;
}
inline long long gcd(long long x, long long y) { return x ? gcd(y % x, x) : y; }
inline long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
int v[60];
vector<int> ans1, ans2;
bitset<N> bit[52][26];
int main() {
  int n;
  scanf("%d", &n);
  int sum = 0, m = n * 2;
  for (int i = 1; i <= m; ++i) scanf("%d", &v[i]), sum += v[i];
  sort(v + 1, v + m + 1);
  ans1.push_back(v[1]), sum -= v[1];
  ans2.push_back(v[2]), sum -= v[2];
  bit[2][0].set(0);
  for (int i = 3; i <= m; ++i) {
    bit[i][0].set(0);
    for (int j = 1; j < n; ++j) {
      bit[i][j] = bit[i - 1][j] | (bit[i - 1][j - 1] << v[i]);
    }
  }
  sum /= 2;
  while (!bit[m][n - 1][sum]) sum--;
  for (int i = m, j = n - 1; i >= 3; --i) {
    if (j && sum >= v[i] && bit[i - 1][j - 1][sum - v[i]]) {
      ans1.push_back(v[i]);
      sum -= v[i];
      --j;
    } else
      ans2.push_back(v[i]);
  }
  sort(ans1.begin(), ans1.end());
  sort(ans2.begin(), ans2.end());
  for (int i = 0; i < n; ++i) printf("%d%c", ans2[i], " \n"[i == n - 1]);
  for (int i = 1; i <= n; ++i) printf("%d%c", ans1[n - i], " \n"[i == n]);
  return 0;
}