Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the following conditions held:

  * a < b < c; 
  * a divides b, b divides c. 



Naturally, Xenia wants each element of the sequence to belong to exactly one group of three. Thus, if the required partition exists, then it has <image> groups of three.

Help Xenia, find the required partition or else say that it doesn't exist.

Input

The first line contains integer n (3 ≤ n ≤ 99999) — the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7.

It is guaranteed that n is divisible by 3.

Output

If the required partition exists, print <image> groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them.

If there is no solution, print -1.

Examples

Input

6
1 1 1 2 2 2


Output

-1


Input

6
2 2 1 1 4 6


Output

1 2 4
1 2 6
import java.util.*;
import java.io.*;
import java.math.*;

import static java.lang.Math.*;

public class Solution implements Runnable {
	
	public void solve() throws Exception {
		int n = sc.nextInt();
		int a [] = new int [n];
		int count [] = new int [8];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			count[a[i]]++;
		}
		int ans [][] = new int [n / 3][3];
		int k = 0;

		// 1 - 2 - 4
		int cnt = min (count[1], min (count[2], count[4]));
		for (int i = 0; i < cnt; i++) {
			ans[k][0] = 1;
			ans[k][1] = 2;
			ans[k][2] = 4;
			k++;
			count[1]--;
			count[2]--;
			count[4]--;
		}
		// 1 - 2 - 6
		cnt = min (count[1], min (count[2], count[6]));
		for (int i = 0; i < cnt; i++) {
			ans[k][0] = 1;
			ans[k][1] = 2;
			ans[k][2] = 6;
			k++;
			count[1]--;
			count[2]--;
			count[6]--;
		}
		// 1 - 3 - 6
		cnt = min (count[1], min (count[3], count[6]));
		for (int i = 0; i < cnt; i++) {
			ans[k][0] = 1;
			ans[k][1] = 3;
			ans[k][2] = 6;
			k++;
			count[1]--;
			count[3]--;
			count[6]--;
		}
		
		for (int i = 1; i <= 7; i++) {
			if (count[i] > 0) {
				out.println(-1);
				return;
			}
		}
		for (int i = 0; i < n / 3; i++) {
			out.println(ans[i][0]+" "+ans[i][1]+" "+ans[i][2]);
		}
	}


	static Throwable t;

	BufferedReader in;
	FastScanner sc;
	PrintWriter out;

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable t) {
			Solution.t = t;
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) throws Throwable {
		Thread thread = new Thread(null, new Solution(), "", 1 << 26);
		thread.start();
		thread.join();
		if (Solution.t != null)
			throw t;
	}

}

class FastScanner {

	BufferedReader in;
	StringTokenizer st;

	public FastScanner(BufferedReader in) {
		this.in = in;
	}

	public String nextToken() throws Exception {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	public int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws Exception {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws Exception {
		return Double.parseDouble(nextToken());
	}

}