Problem: An arithmetic progression is such a non-empty sequence of numbers where the difference between any two successive numbers is constant. This constant number is called common difference. For example, the sequence 3, 7, 11, 15 is an arithmetic progression. The definition implies that any sequences whose length equals 1 or 2 are arithmetic and all sequences whose length equals 0 are non-arithmetic.

You are given a sequence of different integers a1, a2, ..., an. You should either split it into two arithmetic progressions or find out that the operation is impossible to perform. Splitting assigns each member of the given sequence to one of two progressions, but the relative order of numbers does not change. Splitting is an inverse operation to merging.

Input

The first line contains a positive integer n (2 ≤ n ≤ 30000), n is the length of the given sequence. The second line contains elements of the given sequence a1, a2, ..., an ( - 108 ≤ ai ≤ 108). The elements of the progression are different integers.

Output

Print the required arithmetic progressions, one per line. The progressions can be positioned in any order. Each progression should contain at least one number. If there's no solution, then print "No solution" (without the quotes)in the only line of the input file. If there are several solutions, print any of them.

Examples

Input

6
4 1 2 7 3 10


Output

1 2 3 
4 7 10 


Input

5
1 2 3 -2 -7


Output

1 2 3 
-2 -7 

Note

In the second sample another solution is also possible (number three can be assigned to the second progression): 1, 2 and 3, -2, -7.

Solution (in JAVA):

Solution:
import java.util.Arrays;
import java.util.Scanner;

public class Test2D {

	static int[] a;
	static int[] ans;
	static int n;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		n = in.nextInt();
		if (n <= 4) {
			if (n == 2) {
				System.out.println(in.nextInt() + "\n" + in.nextInt());
			} else if (n == 3) {
				System.out.println(in.next() + "\n" + in.next() + " "
						+ in.next());
			} else {
				System.out.println(in.next() + " " + in.next() + "\n"
						+ in.next() + " " + in.next());
			}
			return;
		}
		a = new int[n];
		ans = new int[n];
		b = new boolean[n];
		for (int i = 0; i < n; ++i) {
			a[i] = in.nextInt();
		}
		check(0, 1);
		check(0, 2);
		check(1, 2);
		System.out.println("No solution");
	}

	static boolean[] b;

	private static void check(int i1, int i2) {
		int d = a[i2] - a[i1];
		// boolean[] b = new boolean[n];
		Arrays.fill(b, false);
		b[i1] = true;
		b[i2] = true;
		int i = i2 + 1;
		long go = a[i2] + d;
		for (; i < n; ++i) {
			if (a[i] == go) {
				b[i] = true;
				go += (long) d;
			}
		}
		len = 0;
		for (int j = 0; j < n; ++j)
			if (!b[j]) {
				ans[len++] = a[j];
			}
		if (len == 0) {
			for (int j = 0; j < n - 1; ++j)
				System.out.print(a[j] + " ");
			System.out.println("\n" + a[n - 1]);
			System.exit(0);
		}
		if (checkprog()) {
			for (int j = 0; j < len; ++j)
				System.out.print(ans[j] + " ");
			System.out.println();
			for (int j = 0; j < n; ++j)
				if (b[j])
					System.out.print(a[j] + " ");
			System.exit(0);
		}
		for (int j = n - 1; j > 0; --j)
			if (b[j]) {
				b[j] = false;
				break;
			}
		len = 0;
		for (int j = 0; j < n; ++j)
			if (!b[j]) {
				ans[len++] = a[j];
			}
		if (len == 0) {
			for (int j = 0; j < n - 1; ++j)
				System.out.print(a[j] + " ");
			System.out.println("\n" + a[n - 1]);
			System.exit(0);
		}
		if (checkprog()) {
			for (int j = 0; j < len; ++j)
				System.out.print(ans[j] + " ");
			System.out.println();
			for (int j = 0; j < n; ++j)
				if (b[j])
					System.out.print(a[j] + " ");
			System.exit(0);
		}
	}

	static int len;

	private static boolean checkprog() {
		if (len <= 2)
			return true;
		int d = ans[1] - ans[0];
		for (int i = 2; i < len; ++i)
			if (ans[i] - ans[i - 1] != d)
				return false;
		return true;
	}
}