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 N = 30, A = 5e4 + 10, S = 7e5 + 10;
int a[2 * N];
vector<pair<int, int> > at1[N], at2[N];
vector<int> get_masks(int* a, int n);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  n *= 2;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  sort(a + 1, a + 1 + n);
  swap(a[2], a[n]);
  sort(a + 2, a + n);
  int half = (n - 2) / 2, tot = (1 << half);
  int sum = 0;
  for (int i = 2; i < n; ++i) {
    sum += a[i];
  }
  int target = sum / 2;
  vector<int> s1 = get_masks(&a[2], half);
  vector<int> s2 = get_masks(&a[half + 2], half);
  for (int i = 0; i < tot; ++i) {
    int sz = __builtin_popcount(i);
    at1[sz].push_back({s1[i], i});
    at2[sz].push_back({s2[i], i});
  }
  for (int sz = 0; sz <= half; ++sz) {
    sort(at1[sz].begin(), at1[sz].end());
    sort(at2[sz].begin(), at2[sz].end());
  }
  int best = -1, best_mask1 = 0, best_mask2 = 0;
  for (int sz1 = 0; sz1 <= half; ++sz1) {
    int sz2 = half - sz1;
    int c1 = at1[sz1].size(), c2 = at2[sz2].size();
    int p2 = c2 - 1;
    for (int p1 = 0; p1 < c1; ++p1) {
      while (p2 > 0 and at1[sz1][p1].first + at2[sz2][p2].first > target) {
        --p2;
      }
      int cand = at1[sz1][p1].first + at2[sz2][p2].first;
      if (cand <= target and cand > best) {
        best = cand;
        best_mask1 = at1[sz1][p1].second;
        best_mask2 = at2[sz2][p2].second;
      }
    }
  }
  vector<int> a1, a2;
  a1.push_back(a[1]);
  for (int i = 2; i <= half + 1; ++i) {
    if ((best_mask1 >> (i - 2)) & 1) {
      a1.push_back(a[i]);
    } else {
      a2.push_back(a[i]);
    }
  }
  for (int i = half + 2; i <= n - 1; ++i) {
    if ((best_mask2 >> (i - (half + 2))) & 1) {
      a1.push_back(a[i]);
    } else {
      a2.push_back(a[i]);
    }
  }
  reverse(a2.begin(), a2.end());
  a2.push_back(a[n]);
  for (auto& i : a1) {
    cout << i << ' ';
  }
  cout << '\n';
  for (auto& i : a2) {
    cout << i << ' ';
  }
  cout << '\n';
}
vector<int> get_masks(int* a, int n) {
  int tot = (1 << n);
  vector<int> ans(tot, 0);
  ans[0] = 0;
  for (int i = 1; i < tot; ++i) {
    int b = __builtin_ctz(i);
    ans[i] = a[b] + ans[i ^ (1 << b)];
  }
  return ans;
}