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.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;

/**
 * <a href="http://codeforces.com/problemset/problem/342/A"/>
 *
 * @author pvasilyev
 * @since 27 Jun 2015
 */
public class Problem125 {

    public static void main(String[] args) {
        final InputReader reader = new InputReader(System.in);
        final PrintWriter writer = new PrintWriter(System.out);

        solve(reader, writer);

        writer.close();
    }

    private static void solve(final InputReader reader, final PrintWriter writer) {
        final int n = reader.readInt();
        int[] a = IOUtils.readIntArray(reader, n);
        boolean[] taken = new boolean[n];
        int[] result = new int[n];
        final long start = System.currentTimeMillis();
        int[] count = new int[7];
        for (int i = 0; i < a.length; i++) {
            count[a[i]-1]++;
        }
        int p = 0;
        int[] sorted = new int[n];
//        for (int i = 0; i < count.length; i++) {
//            int countOfI = count[i];
//            for (int j = 0; j < countOfI; ++j) {
//                sorted[p] = i+1;
//                p++;
//            }
//        }


//        writer.println(System.currentTimeMillis() - start);


        int resultPointer = 0;
        boolean exists = true;

        while (true) {
            int pointer = 0;
            if (resultPointer == result.length) {
                break;
            }
            while (true) {
                if (pointer == count.length) {
                    exists = false;
                    break;
                }
                if (count[pointer] > 0) {
                    break;
                } else {
                    pointer++;
                }
            }
            if (!exists) {
                break;
            }

            result[resultPointer] = pointer+1;
            count[pointer]--;
            resultPointer++;
            pointer++;

            while (true) {
                if (pointer == count.length) {
                    exists = false;
                    break;
                }
                if (count[pointer] > 0 && (pointer+1) % result[resultPointer-1] == 0) {
                    break;
                } else {
                    pointer++;
                }
            }

            if (!exists) {
                break;
            }

            result[resultPointer] = pointer+1;
            count[pointer]--;
            resultPointer++;
            pointer++;

            while (true) {
                if (pointer == count.length) {
                    exists = false;
                    break;
                }
                if (count[pointer] > 0 && (pointer+1) % result[resultPointer-1] == 0) {
                    break;
                } else {
                    pointer++;
                }
            }

            if (!exists) {
                break;
            }

            result[resultPointer] = pointer+1;
            count[pointer]--;
            resultPointer++;

        }

//        while (true) {
//            int pointer = findMinimalFirstNotTaken(taken, lastPointer);
//            lastPointer = pointer;
//            if (pointer == taken.length) {
//                break;
//            }
//            result[resultPointer] = sorted[pointer];
//            taken[pointer] = true;
//            resultPointer++;
//            pointer++;
//            while (true) {
//                if (pointer == sorted.length) {
//                    exists = false;
//                    break;
//                }
//                if (taken[pointer]) {
//                    pointer++;
//                    continue;
//                }
//                if (sorted[pointer] == result[resultPointer - 1] || sorted[pointer] % result[resultPointer - 1] != 0) {
//                    pointer++;
//                } else {
//                    break;
//                }
//            }
//            if (!exists) {
//                break;
//            }
//            result[resultPointer] = sorted[pointer];
//            taken[pointer] = true;
//            resultPointer++;
//            pointer++;
//            while (true) {
//                if (pointer == sorted.length) {
//                    exists = false;
//                    break;
//                }
//                if (taken[pointer]) {
//                    pointer++;
//                    continue;
//                }
//                if (sorted[pointer] == result[resultPointer - 1] || sorted[pointer] % result[resultPointer - 1] != 0) {
//                    pointer++;
//                } else {
//                    break;
//                }
//            }
//            if (!exists) {
//                break;
//            }
//            result[resultPointer] = sorted[pointer];
//            taken[pointer] = true;
//            resultPointer++;
//
//        }

        if (!exists) {
            writer.println(-1);
        } else {
            for (int i = 0; i < result.length; i += 3) {
                writer.println(result[i] + " " + result[i + 1] + " " + result[i + 2]);
            }
        }
//        writer.println(System.currentTimeMillis() - start);
    }

    private static int findMinimalFirstNotTaken(final boolean[] taken, final int lastPointer) {
        int pointer = lastPointer;
        while (pointer < taken.length && taken[pointer]) {
            pointer++;
        }
        return pointer;
    }

}


class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

class IOUtils {

    public static int[] readIntArray(InputReader in, int size) {
        int[] array = new int[size];
        for (int i = 0; i < size; i++)
            array[i] = in.readInt();
        return array;
    }

}
