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
from functools import reduce
from collections import Counter
import time
import datetime

def time_t():
    print("Current date and time: " , datetime.datetime.now())
    print("Current year: ", datetime.date.today().strftime("%Y"))
    print("Month of year: ", datetime.date.today().strftime("%B"))
    print("Week number of the year: ", datetime.date.today().strftime("%W"))
    print("Weekday of the week: ", datetime.date.today().strftime("%w"))
    print("Day of year: ", datetime.date.today().strftime("%j"))
    print("Day of the month : ", datetime.date.today().strftime("%d"))
    print("Day of week: ", datetime.date.today().strftime("%A"))

def ip():
    return int(input())

def sip():
    return input()

def mip():
    return map(int,input().split())

def mips():
	return map(str,input().split())

def lip():
    return list(map(int,input().split()))

def matip(n,m):
    lst=[]
    for i in range(n):
        arr = lip()
        lst.append(arr)
    return lst

def factors(n): # find the factors of a number
    return list(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))

def minJumps(arr, n): #to reach from 0 to n-1 in the array in minimum steps 
	jumps = [0 for i in range(n)] 

	if (n == 0) or (arr[0] == 0): 
		return float('inf') 
	jumps[0] = 0
	for i in range(1, n): 
		jumps[i] = float('inf') 
		for j in range(i): 
			if (i <= j + arr[j]) and (jumps[j] != float('inf')): 
				jumps[i] = min(jumps[i], jumps[j] + 1) 
				break
	return jumps[n-1] 

def dic(arr): # converting list into dict of count
	return Counter(arr)

n = ip()
arr = lip()
four = arr.count(4)
two = arr.count(2)
three = arr.count(3)
six = arr.count(6)
one = arr.count(1)
if six+four+three+two+one<n:
    print(-1)
else:
    lst = []
    if four+six==one:
        if two>=four:
            two = two-four
            for i in range(four):
                lst.append([1,2,4])
            if two+three==six:
                for i in range(three):
                    lst.append([1,3,6])
                for i in range(two):
                    lst.append([1,2,6])
                for item in lst:
                    print(*item)
            else:
                print(-1)
        else:
            print(-1) 
    else:
        print(-1)