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 warning(disable : 4996)
using namespace std;
using ld = long double;
template <class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> v) {
  os << "( " << v.first << ", " << v.second << ")";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << " ";
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << endl;
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<set<T>> &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) {
      os << endl;
    }
    os << v[i];
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &v) {
  int i = 0;
  for (auto it : v) {
    if (i > 0) {
      os << ' ';
    }
    os << it;
    i++;
  }
  return os;
}
using ll = unsigned long long;
using MyBitset = vector<ll>;
void add(const MyBitset &a, int offset, MyBitset &b) {
  const int mo = offset & 63;
  assert(a.size() == b.size());
  assert(offset >= 0);
  const int len = offset >> 6;
  for (int l = 0; l < a.size() - len; ++l) {
    b[l + len] |= a[l] << mo;
    if (mo && l != a.size() - len - 1) b[l + len + 1] |= a[l] >> (64 - mo);
  }
}
int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  N *= 2;
  vector<int> v(N);
  for (int i = 0; i < N; ++i) cin >> v[i];
  sort(v.begin(), v.end());
  ll answer = v[0] + v[1];
  int mm = v[0], mmm = v[1];
  v = vector<int>(v.begin() + 2, v.end());
  vector<vector<vector<ll>>> memo(N - 1,
                                  vector<vector<ll>>(N / 2, vector<ll>(30000)));
  memo[0][0][0] = 1;
  int sum = accumulate(v.begin(), v.end(), 0);
  for (int i = 0; i < N - 2; ++i) {
    vector<vector<ll>> nmemo = vector<vector<ll>>(N / 2, vector<ll>(30000));
    for (int j = 0; j < N / 2; ++j) {
      int x = v[i];
      if (j != N / 2 - 1) {
        add(memo[i][j], x, nmemo[j + 1]);
      }
      for (int k = 0; k < 30000; ++k) {
        nmemo[j][k] |= memo[i][j][k];
      }
    }
    memo[i + 1] = nmemo;
  }
  int ad = 1e9;
  for (int i = 0; i < 30000; ++i) {
    for (int j = 0; j < 64; ++j) {
      int x = (i << 6) + j;
      if (memo[N - 2][N / 2 - 1][i] & (1ull << j)) {
        ad = min(ad, max(x, sum - x));
      }
    }
  }
  answer += ad;
  vector<int> up_ids, do_ids;
  int now_sum = ad;
  int now_rest = N / 2 - 1;
  ;
  for (int i = N - 2; i >= 0; --i) {
    if (!i) break;
    int now_mo = now_sum & 63;
    int now_pl = now_sum >> 6;
    assert(memo[i][now_rest][now_pl] & (1ull << now_mo));
    if (memo[i - 1][now_rest][now_pl] & (1ull << now_mo)) {
      do_ids.push_back(i - 1);
    } else {
      up_ids.push_back(i - 1);
      now_sum -= v[i - 1];
      now_rest--;
    }
  }
  cout << mm;
  sort(up_ids.begin(), up_ids.end());
  for (int i = 0; i < N / 2 - 1; ++i) {
    cout << ' ' << v[up_ids[i]];
  }
  cout << endl;
  for (int i = 0; i < N / 2 - 1; ++i) {
    cout << v[do_ids[i]] << ' ';
  }
  cout << mmm;
  cout << endl;
  return 0;
}