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;
int out(int x, int a, int b) { return x < a || x > b; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  vector<int> x(2 * n);
  int second = 0, shere;
  for (int i = 0; i < 2 * n; ++i) cin >> x[i], second += x[i];
  sort(x.begin(), x.end());
  vector<pair<int, int> > sum(1300000);
  for (int i = 1; i < 1300000; ++i) sum[i] = {1000000007, -1000000007};
  sum[0] = {0, 0};
  int ans = 1000000007;
  vector<pair<int, int> > bst(1300000);
  int many = 0, pos = 0;
  shere = second;
  for (int i = 2 * n - 1; i >= 1; --i) {
    int sall = second - x[i] - x[0];
    int mov_r = shere - x[i] - x[0];
    vector<pair<int, int> > cur(1300000);
    for (int j = 0; j + mov_r < 1300000; ++j) {
      cur[j + mov_r] = {sum[j].first + i - 1, sum[j].second + i - 1};
    }
    int enter = 0;
    for (int j = 0; j < 1300000; ++j) {
      if (cur[j].first >= 1000000007 || out(n - 1, cur[j].first, cur[j].second))
        continue;
      if (max(j, sall - j) + x[0] + x[i] < ans) {
        ans = max(j, sall - j) + x[0] + x[i];
        enter = 1;
        many = n - i;
        pos = j;
      }
    }
    if (enter) bst = cur;
    for (int j = 1300000 - x[i] - 1; j >= 0; --j) {
      if (sum[j].first == 1000000007) continue;
      sum[j + x[i]].first = min(sum[j + x[i]].first, sum[j].first + 1);
      sum[j + x[i]].second = max(sum[j + x[i]].second, sum[j].second + 1);
    }
    shere -= x[i];
  }
  vector<int> up, down;
  vector<int> vis(2 * n);
  for (int i = 0; i < n - many; ++i) up.push_back(x[i]), vis[i] = 1;
  for (int i = 2 * n - 1, put = 0; i >= 0 && many; --i) {
    if (pos - x[i] >= 0 &&
        !out(n - 2 - put, bst[pos - x[i]].first, bst[pos - x[i]].second)) {
      many--;
      put++;
      pos -= x[i];
      up.push_back(x[i]);
      vis[i] = 1;
    }
  }
  for (int i = 0; i < 2 * n; ++i)
    if (!vis[i]) down.push_back(x[i]);
  sort(up.begin(), up.end());
  sort(down.rbegin(), down.rend());
  for (int i = 0; i < n; ++i) cout << up[i] << ' ';
  cout << '\n';
  for (int i = 0; i < n; ++i) cout << down[i] << ' ';
  cout << '\n';
}