import java.io.*;
import java.util.*;

public class split_vd_20_assert {

	class Drink implements Comparable<Drink> {
		int l, r;
		int diff;
		int max;

		public Drink(int l, int r, int diff, int max) {
			super();
			this.l = l;
			this.r = r;
			this.diff = diff;
			this.max = max;
		}

		public int compareTo(Drink o) {
			if (diff == o.diff) {
				return o.max -max;
			}
			return diff - o.diff;
		}
	}

	void solve() throws IOException {
		int n = nextInt();
		if (n > 100)
		throw new AssertionError();
		int[] a = new int[2 * n];
		for (int i = 0; i < 2 * n; i++) {
			a[i] = nextInt();
		}
		Arrays.sort(a);
		TreeSet<Integer> index = new TreeSet<Integer>();
		PriorityQueue<Drink> que = new PriorityQueue<>();
		for (int i = 1; i < 2 * n; i++) {
			que.add(new Drink(i - 1, i, a[i] - a[i - 1], a[i]));
			index.add(i);
		}
		index.add(0);
		boolean[] taken = new boolean[2 * n];
		ArrayList<Integer> nevill = new ArrayList<>();
		ArrayList<Integer> harry = new ArrayList<>();
		while (!que.isEmpty()) {
			Drink v = que.poll();
			if (taken[v.r]) {
				continue;
			}
			if (taken[v.l]) {
				Integer x = index.lower(v.l);
				if (x != null) {
					que.add(new Drink(x, v.r, a[v.r] - a[x], a[v.r]));
				}
				continue;
			}
			nevill.add(a[v.r]);
			harry.add(a[v.l]);
			index.remove(v.r);
			index.remove(v.l);
			taken[v.r] = true;
			taken[v.l] = true;
		}
		for (int i : nevill) {
			out.print(i + " ");
		}
		out.println();
		for (int i : harry) {
			out.print(i + " ");
		}
		out.println();
	}

	public void run() throws IOException {
		br = new BufferedReader(new FileReader("split.in"));
		out = new PrintWriter("split.out");
		solve();
		br.close();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new split_vd_20_assert().run();
	}

	BufferedReader br;
	StringTokenizer str;
	PrintWriter out;

	String next() throws IOException {
		while (str == null || !str.hasMoreTokens()) {
			String s = br.readLine();
			if (s != null) {
				str = new StringTokenizer(s);
			} else {
				return null;
			}
		}
		return str.nextToken();
	}

	long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

}
