#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  map<long long int, long long int> m;
  for (long long int i = 1; i <= n; i++) {
    long long int a;
    cin >> a;
    if (a == 7 || a == 5) {
      cout << "-1";
      return 0;
    } else
      m[a]++;
  }
  long long int six = m[6];
  long long int four = m[4];
  long long int three = m[3];
  if (m[6] == 0 && m[4] == 0) {
    cout << "-1";
    return 0;
  }
  if (m[3] > 0 && m[6] < m[3]) {
    cout << "-1";
    return 0;
  }
  if (m[2] > 0 && m[4] + m[6] < m[2]) {
    cout << "-1";
    return 0;
  }
  if (m[4] > 0) {
    m[1] -= m[4];
    m[2] -= m[4];
    m[4] = 0;
    if (m[1] < 0 || m[2] < 0 || m[4] != 0) {
      cout << "-1";
      return 0;
    }
  }
  if (m[6] > 0) {
    m[1] -= m[6];
    m[6] -= m[3];
    m[6] -= m[2];
    if (m[6] != 0 || m[1] != 0) {
      cout << "-1";
      return 0;
    }
  }
  for (long long int i = 1; i <= three; i++) {
    cout << "1 3 6" << endl;
  }
  for (long long int i = 1; i <= six - three; i++) {
    cout << "1 2 6" << endl;
  }
  for (long long int i = 1; i <= four; i++) {
    cout << "1 2 4" << endl;
  }
}
