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
#!/usr/bin/env python
from __future__ import division, print_function
import math
import os
import sys
from sys import stdin,stdout
from io import BytesIO, IOBase
from itertools import accumulate
from collections import deque
#sys.setrecursionlimit(10**5)
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
#sys.setrecursionlimit(10**6)

# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")
#-----------------------------------------------------------------

def regularbracket(t):
    p=0
    for i in t:
        if i=="(":
            p+=1
        else:
            p-=1
        if p<0:
            return False
    else:
        if p>0:
            return False
        else:
            return True

#-------------------------------------------------
def binarySearchCount(arr, n, key):
    left = 0
    right = n - 1

    count = 0

    while (left <= right):
        mid = int((right + left) / 2)

        # Check if middle element is
        # less than or equal to key
        if (arr[mid] <= key):
            count = mid+1
            left = mid + 1

        # If key is smaller, ignore right half
        else:
            right = mid - 1
    return count
#------------------------------reverse string(pallindrome)
def reverse1(string):
    pp=""
    for i in string[::-1]:
        pp+=i
    if pp==string:
        return True
    return False
#--------------------------------reverse list(paindrome)
def reverse2(list1):
    l=[]
    for i in list1[::-1]:
        l.append(i)
    if l==list1:
        return True
    return False
def mex(list1):
    #list1 = sorted(list1)
    p = max(list1)+1
    for i in range(len(list1)):
        if list1[i]!=i:
            p = i
            break
    return p
def sumofdigits(n):
    n = str(n)
    s1=0
    for i in n:
        s1+=int(i)
    return s1
def perfect_square(n):
    s = math.sqrt(n)
    if s==int(s):
        return True
    return False
#print(perfect_square(16))
#endregion-------------------------------------------

def soretd(s):
    for i in range(1,len(s)):
        if s[i-1]>s[i]:
            return False
    return True
#print(soretd("1"))
"""
def main():
    n = int(input())
    arr = list(map(int,input().split()))
    l=[arr[0]]
    i=1
    while(i<len(arr)-2):
        if arr[i+1]>arr[i]:
            l.append(arr[i+1])
            i+=2
        else:
            l.append(arr[i])
            i+=1
    l.append(arr[n-1])
    print(min(l))
"""
def main():
    n = int(input())
    l=[[1,2,6],[1,2,4],[1,3,6]]
    arr = list(map(int,input().split()))
    ans=[]
    if 5 in arr or 7 in arr:
        print(-1)
    else:
        one = arr.count(1)
        four = arr.count(4)
        if one!=n//3:
            print(-1)
        else:
            two = arr.count(2)
            three = arr.count(3)
            if 4 in arr:
                for i in range(four):
                    ans.append([1,2,4])
                two-=four
                one-=four
            if two<0 or three<0:
                print(-1)
            #six = arr.count(6)
            else:
                if two>0:
                    for i in range(two):
                        ans.append([1,2,6])
                if three>0:
                    for i in range(three):
                        ans.append([1,3,6])
           # print(ans)
                if len(ans)!=n//3:
                    print(-1)
                else:
                    for i in ans:
                        print(*i)
if __name__ == '__main__':
    main()