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
/**
 * Created with IntelliJ IDEA.
 * User: den
 * Date: 9/7/13
 * Time: 11:02 AM
 * To change this template use File | Settings | File Templates.
 */


import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class TaskA extends Thread {
    private void solve() throws IOException {
        int as = 0;
        int bs = 0;
        int cs = 0;
        int ds = 0;
        int es = 0;
        int n = _int();
        int[] a = new int[n];
        for (int i =0; i<n; i++){
           a[i] = _int();
           if (a[i] != 1 && a[i] != 2 && a[i] != 3 && a[i] !=4 && a[i] !=6){
               out.println(-1);
               return;
           }
            if (a[i] == 1) as++;
            if (a[i] == 2) bs++;
            if (a[i] == 3) cs++;
            if (a[i] == 4) ds++;
            if (a[i] == 6) es++;
        }

        if (as != n/3 || (bs + cs) != n/3 || (ds + es) != n/3 || cs > es || ds > bs) {
            out.println(-1);
            return;
        }

        for (int i = 0; i < ds; i++){
            out.println("1 2 4");
        }
        bs -= ds;
        for (int i = 0; i < bs; i++){
            out.println("1 2 6");
        }
        for (int i=0; i < cs; i++){
            out.println("1 3 6");
        }
    }

    public void run() {
        try {
            solve();
        } catch (Exception e) {
            System.out.println("System exiting....");
            e.printStackTrace();
            System.exit(888);
        } finally {
            out.flush();
            out.close();
        }
    }

    public static void main(String[] args) throws FileNotFoundException {
        new TaskA().run();
    }

    public TaskA() throws FileNotFoundException {
        //in = new BufferedReader(new FileReader("A-large.in"));
        //out = new PrintWriter(new File("A-large.out"));
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        setPriority(Thread.MAX_PRIORITY);
    }

    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer st;

    private int _int() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private double _double() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private long _long() throws IOException {
        return Long.parseLong(nextToken());
    }

    private char[] _chars() throws IOException {
        return nextToken().toCharArray();
    }

    private String nextToken() throws IOException {
        if (st == null || !st.hasMoreElements())
            st = new StringTokenizer(in.readLine(), " \t\r\n");
        return st.nextToken();
    }
}

//6
//1 3 3 1 4 6

