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.lang.*;
import java.io.*;

public class XeniaAndDivisors {
    BufferedReader input;
    BufferedWriter output;
    StringTokenizer st;
    
    // My Solution
    void solve() throws IOException {
        int n = getInt();
        int[] a = getInts(n);
        int[] freq = new int[8];
        for (int i = 0; i < n; i++) {
            freq[a[i]]++;
        }
        String p = "1 2 4";
        String q = "1 2 6";
        String r = "1 3 6";
        int pCount = 0;
        int qCount = 0;
        int rCount = 0;
        while (true){
            if(!(freq[1]==(freq[2]+freq[3]) && freq[1]==(freq[4]+freq[6]))){
                break;
            }
            if(freq[1]<=0)
                break;
            if(freq[2]>0){
                if(freq[4]>0){
                    int v = min(freq[1], freq[2], freq[4]);
                    pCount+=v;
                    freq[1]-=v;
                    freq[2]-=v;
                    freq[4]-=v;
                }else if(freq[6]>0){
                    int v = min(freq[1], freq[2], freq[6]);
                    qCount+=v;
                    freq[1]-=v;
                    freq[2]-=v;
                    freq[6]-=v;
                }
            }else if(freq[3]>0 && freq[6]>0){
                int v = min(freq[1], freq[3], freq[6]);
                rCount+=v;
                freq[1]-=v;
                freq[3]-=v;
                freq[6]-=v;
            }else
                break;
        }
        if((pCount+qCount+rCount)==n/3){
            StringBuilder stringBuilder = new StringBuilder();
            for (int i = 0; i < pCount + qCount + rCount; i++) {
                if(i<pCount)
                    stringBuilder.append(p).append("\n");
                else if(i<pCount+qCount)
                    stringBuilder.append(q).append("\n");
                else
                    stringBuilder.append(r).append("\n");
            }
            print(stringBuilder.toString());
        }else {
            print("-1\n");
        }
    }
    
    
    // Some basic functions
    int min(int...i){
        int min = Integer.MAX_VALUE;
        for (int value : i) min = Math.min(min, value);
        return min;
    }
    int max(int...i){
        int max = Integer.MIN_VALUE;
        for (int value : i) max = Math.max(max, value);
        return max;
    }
    // Printing stuff
    void print(int... i) throws IOException {
        for (int value : i) output.write(value + " ");
    }
    void print(long... l) throws IOException {
        for (long value : l) output.write(value + " ");
    }
    void print(String... s) throws IOException {
        for (String value : s) output.write(value);
    }
    void nextLine() throws IOException {
        output.write("\n");
    }
    // Taking Inputs
    int[][] getIntMat(int n, int m) throws IOException {
        int[][] mat = new int[n][m];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                mat[i][j] = getInt();
        return mat;
    }
    char[][] getCharMat(int n, int m) throws IOException {
        char[][] mat = new char[n][m];
        for (int i = 0; i < n; i++) {
            String s = input.readLine();
            for (int j = 0; j < m; j++) 
                mat[i][j] = s.charAt(j);
        }
        return mat;
    }
    int getInt() throws IOException {
        if(st ==null || !st.hasMoreTokens())
            st = new StringTokenizer(input.readLine());
        return Integer.parseInt(st.nextToken());
    }
    int[] getInts(int n) throws IOException {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = getInt();
        return a;
    }
    long getLong() throws IOException {
        if(st==null || !st.hasMoreTokens())
            st = new StringTokenizer(input.readLine());
        return Long.parseLong(st.nextToken());
    }
    long[] getLongs(int n) throws IOException {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = getLong();
        return a;
    }
    // Checks whether the code is running on OnlineJudge or LocalSystem
    boolean isOnlineJudge() {
        if (System.getProperty("ONLINE_JUDGE") != null)
            return true;
        try {
            return System.getProperty("LOCAL")==null;
        } catch (Exception e) {
            return true;
        }
    }
    // Handling CodeExecution
    public static void main(String[] args) throws Exception {
        new XeniaAndDivisors().run();
    }
    void run() throws IOException {
        // Defining Input Streams
        if (isOnlineJudge()) {
            input = new BufferedReader(new InputStreamReader(System.in));
            output = new BufferedWriter(new OutputStreamWriter(System.out));
        } else {
            input = new BufferedReader(new FileReader("input.txt"));
            output = new BufferedWriter(new FileWriter("output.txt"));
        }
        // Running Logic
        solve();
        output.flush();
        // Run example test cases
        if (!isOnlineJudge()) {
            BufferedReader output = new BufferedReader(new FileReader("output.txt"));
            BufferedReader answer = new BufferedReader(new FileReader("answer.txt"));
            StringBuilder outFile = new StringBuilder();
            StringBuilder ansFile = new StringBuilder();
            String temp;
            while ((temp = output.readLine()) != null)
                outFile.append(temp.trim());
            while ((temp = answer.readLine()) != null)
                ansFile.append(temp.trim());
            if (outFile.toString().equals(ansFile.toString()))
                System.out.println("Test Cases Passed!!!");
            else
                System.out.println("Failed...");
        }
    }
}