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.text.*;
import java.math.*;
import java.lang.Math.*;

public class C {
	
	public static void main(String[] args) throws Exception {new C().run();}
	public FastIO file = new FastIO();
	public int ntc, ctc;
	public final long MOD = 1000000007L; //998244353L; 
	public final int M0D = 1000000007; //998244353
	public final int N = 200005, dx[] = { 0, 1, 0, -1 }, dy[] = { 1, 0, -1, 0 };
	
	public void run() throws Exception {
		ntc = 1; //nextInt();
		for (ctc = 1; ctc <= ntc; ++ctc) solve();
		file.out.flush(); file.out.close();
	}
	
	
	
	void solve() {
		int n = nextInt();
		int[] a = new int[10];
		for (int i = 0; i < n; i++) a[nextInt()]++;
		ArrayList<int[]> ans = new ArrayList<>();
		boolean works = true;
		if (a[7] > 0) {
			works = false;
		}
		while (n > 0) {
			boolean c = false;
			if (a[1] > 0 && a[3] > 0 && a[6] > 0) {
				c = true;
				a[1]--;
				a[3]--;
				a[6]--;
				ans.add(new int[] {1,3,6});
			}
			else if (a[1] > 0 && a[2] > 0 && a[4] > 0) {
				c = true;
				a[1]--;
				a[2]--;
				a[4]--;
				ans.add(new int[] {1,2,4});
			}
			else if (a[1] > 0 && a[2] > 0 && a[6] > 0) {
				c = true;
				a[1]--;
				a[2]--;
				a[6]--;
				ans.add(new int[] {1,2,6});
			}
			if (!c) {
				works = false;
				break;
			}
			n -= 3;
		}
		if (works) {
			for (int i = 0; i < ans.size(); i++) {
				println(ans.get(i)[0] + " " + ans.get(i)[1] + " " + ans.get(i)[2]);
			}
		}
		else {
			println(-1);
		}
	}
	
	void sort(long[] a) { shuffle(a); Arrays.sort(a); }
	void sort(int[] a) { shuffle(a); Arrays.sort(a); }
	void shuffle(long[] a) {
		for (int i = a.length - 1; i >= 0; i--) { int j = (int) (Math.random() * (i + 1)); a[i] ^= a[j] ^ (a[j] = a[i]); } }
	void shuffle(int[] a) {
		for (int i = a.length - 1; i >= 0; i--) { int j = (int) (Math.random() * (i + 1)); a[i] ^= a[j] ^ (a[j] = a[i]); } }
	long gcd(long a, long b) { return b == 0 ? a : gcd(b, a % b); }
	long lcm(long x, long y) { return x / gcd(x, y) * y; }
	long mod(long n, long mod) { return (n % mod + mod) % mod; }
	long max(long a, long b) { return Math.max(a, b); }
	int max(int a, int b) { return Math.max(a, b); }
	long min(long a, long b) { return Math.min(a, b); }
	int min(int a, int b) { return Math.min(a, b); }
	long pow(long n, long p, long mod) { long ret = 1L;
	while (p > 0) { if (p % 2 != 0L) ret = mod(ret * n, mod); n = mod(n * n, mod); p >>= 1L; } return ret; }
	long pow(long n, long p) { long ret = 1L;
	while (p > 0) { if (p % 2 != 0L) ret *= n; n *= n; p >>= 1L; } return ret; }
	boolean isPrime(int n) { 
		if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false;
		for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; }
	String next() {return file.next();}
	int nextInt() {return file.nextInt();}
	long nextLong() {return file.nextLong();}
	double nextDouble() {return file.nextDouble();}
	String nextLine() {return file.nextLine();}
	void print(Object o) {file.out.print(o);}
	void println(Object o) {file.out.println(o);}
	void printf(String s, Object... o) {file.out.printf(s, o);}
	class FastIO {
		BufferedReader br;
		StringTokenizer st;
		PrintWriter out;
		public FastIO() {br = new BufferedReader(new InputStreamReader(System.in));out = new PrintWriter(System.out);}
		String next() {while (st == null || !st.hasMoreElements()) {try {st = new StringTokenizer(br.readLine());} catch (IOException e) {e.printStackTrace();}}return st.nextToken();}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());}
		double nextDouble() {return Double.parseDouble(next());}
		String nextLine() {String str = "";try {str = br.readLine();} catch (IOException e) {e.printStackTrace();} return str;}
		void print(Object o) {out.print(o);}
		void println(Object o) {out.println(o);}
		void printf(String s, Object... o) {out.printf(s, o);} }
	class Pair<A, B> implements Comparable {
		A fi; B se;
		public Pair(A fi, B se) { this.fi = fi; this.se = se; }
		public boolean equals(Object o) { if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		Pair<?, ?> p = (Pair<?, ?>) o; if (!fi.equals(p.fi)) return false; return se.equals(p.se); }
		public int hashCode() { return 31 * fi.hashCode() + se.hashCode(); }
		public String toString() { return fi.toString() + " " + se.toString(); }
		<A, B> Pair<A, B> of(A a, B b) { return new Pair<A, B>(a, b); }
		public int compareTo(Object o) { Pair<?, ?> p = (Pair<?, ?>) o;
		if (fi.equals(p.fi)) return ((Comparable) se).compareTo(p.se); return ((Comparable) fi).compareTo(p.fi); } } }