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
//package com.company;

import javax.print.attribute.IntegerSyntax;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    static boolean[] primecheck = new boolean[1000002];
    static ArrayList<Long> lucky = new ArrayList<>();

    public static void main(String[] args) throws IOException {
        OutputStream outputStream = System.out;
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);
        PROBLEM solver = new PROBLEM();
        int t = 1;
        //t = in.nextInt();
        for (int i = 0; i < t; i++) {
            solver.solve(in, out);
        }
        out.close();
    }

    public static void luckIsCalling(long n){

        long a = n*10 + 4;
        long b = n*10 + 7;

        lucky.add(a);
        lucky.add(b);

        if(a<=4444444444L) luckIsCalling(a);
        if(b<=4444444444L) luckIsCalling(b);
    }

    static class PROBLEM {

        public void solve(FastReader in, PrintWriter out){

            int n = in.nextInt();
            int[] a = new int[n];

            int one = 0, two = 0, three = 0, four = 0, six = 0;

            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                if(a[i] == 1) one++;
                if(a[i] == 2) two++;
                if(a[i] == 3) three++;
                if(a[i] == 4) four++;
                if(a[i] == 6) six++;
            }

            if(one == n/3 && (two + three) == n/3 && (four+six) == n/3){

                if(two >= four && six >= three) {

                    int l = Math.min(Math.min(one, two), four);

                    while (l > 0) {
                        l--;
                        out.println(1 + " " + 2 + " " + 4);
                        one--;
                        two--;
                        four--;
                    }

                    l = Math.min(Math.min(one, two), six);

                    while (l > 0) {
                        l--;
                        out.println(1 + " " + 2 + " " + 6);
                        one--;
                        two--;
                        six--;
                    }

                    l = Math.min(Math.min(one, three), six);

                    while (l > 0) {
                        l--;
                        out.println(1 + " " + 3 + " " + 6);
                        one--;
                        three--;
                        six--;
                    }
                }
                else out.println(-1);




            }else out.println(-1);


//            int n = in.nextInt(), a[] = new int[n+1];
//            ArrayList<Pair<Integer, Integer>> al = new ArrayList<>();
//
//            for (int i = 1; i < n+1; i++) {
//                a[i] = in.nextInt();
//            }
//
//            for (int i = 0; i < n; i++) {
//                al.add(new Pair<>(a[i+1], i+1));
//            }
//
//            Collections.sort(al);
//            out.println(al);
//
//            int ctr = 0;
//            for (int i = 1; i < n+1; i++) {
//                for (int j = i+1; j < n+1; j++) {
//                    if(al.get(i-1).x * al.get(j-1).x <= 2*n) {
//                        if (al.get(i-1).x * al.get(j-1).x == al.get(i-1).y + al.get(j-1).y) {
//                            ctr++;
//                        }
//                    }else break;
//                }
//            }
//
//
//
//            out.println(ctr);






        }
    }

    static boolean isPalindrome(char[] s){
        int flag = 1;
        for (int i = 0; i < s.length; i++) {
            if(s[i] != s[s.length-1-i]){
                flag = 0;
                break;
            }
        }
        if(flag == 1) return true;
        else return false;
    }

    static long gcd(long a, long b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    static boolean isSquare(double a) {
        boolean isSq = false;
        double b = Math.sqrt(a);
        double c = Math.sqrt(a) - Math.floor(b);

        if (c == 0) isSq = true;

        return isSq;
    }

    static int exponentMod(int A, int B, int C) {

        // Base cases
        if (A == 0)
            return 0;
        if (B == 0)
            return 1;

        // If B is even
        long y;
        if (B % 2 == 0) {
            y = exponentMod(A, B / 2, C);
            y = (y * y) % C;
        }

        // If B is odd
        else {
            y = A % C;
            y = (y * exponentMod(A, B - 1,
                    C) % C) % C;
        }

        return (int) ((y + C) % C);
    }

    public static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
        public U x;
        public V y;

        public Pair(U x, V y) {
            this.x = x;
            this.y = y;
        }

        public int hashCode() {
            return (x == null ? 0 : x.hashCode() * 31) + (y == null ? 0 : y.hashCode());
        }

        public boolean equals(Object o) {
            if (this == o)
                return true;
            if (o == null || getClass() != o.getClass())
                return false;
            Pair<U, V> p = (Pair<U, V>) o;
            return (x == null ? p.x == null : x.equals(p.x)) && (y == null ? p.y == null : y.equals(p.y));
        }

        public int compareTo(Pair<U, V> b) {
            int cmpU = x.compareTo(b.x);
            return cmpU != 0 ? cmpU : y.compareTo(b.y);
        }

        public String toString() {
            return String.format("(%s, %s)", x.toString(), y.toString());
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        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());
        }

        char nextChar() {
            return next().charAt(0);
        }

        boolean nextBoolean() {
            return !(nextInt() == 0);
        }
        // boolean nextBoolean(){return Boolean.parseBoolean(next());}

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        public int[] readArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) array[i] = nextInt();
            return array;
        }

    }

    private static int[] mergeSort(int[] array) {

        if (array.length <= 1) {
            return array;
        }

        int midpoint = array.length / 2;

        int[] left = new int[midpoint];
        int[] right;

        if (array.length % 2 == 0) {
            right = new int[midpoint];
        } else {
            right = new int[midpoint + 1];
        }

        for (int i = 0; i < left.length; i++) {
            left[i] = array[i];
        }

        for (int i = 0; i < right.length; i++) {
            right[i] = array[i + midpoint];
        }

        int[] result = new int[array.length];

        left = mergeSort(left);
        right = mergeSort(right);

        result = merge(left, right);

        return result;
    }

    private static int[] merge(int[] left, int[] right) {

        int[] result = new int[left.length + right.length];
        int leftPointer = 0, rightPointer = 0, resultPointer = 0;

        while (leftPointer < left.length || rightPointer < right.length) {

            if (leftPointer < left.length && rightPointer < right.length) {

                if (left[leftPointer] < right[rightPointer]) {
                    result[resultPointer++] = left[leftPointer++];
                } else {
                    result[resultPointer++] = right[rightPointer++];
                }
            } else if (leftPointer < left.length) {
                result[resultPointer++] = left[leftPointer++];
            } else {
                result[resultPointer++] = right[rightPointer++];
            }
        }
        return result;
    }

    public static void Sieve(int n){

        Arrays.fill(primecheck,true);
        primecheck[0]= false;
        primecheck[1] = false;

        for(int i = 2;i*i<n+1;i++){
            if(primecheck[i]){
                for(int j = i*i;j<n+1;j+=i){
                    primecheck[j] = false;
                }
            }
        }
    }
}


