#include <bits/stdc++.h>
using namespace std;
int a[8], d;
int main() {
  int i, j, k, l, n, d = 0;
  ;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> j;
    if (j == 7 || j == 5)
      d = 1;
    else
      a[j]++;
  }
  if (a[4] + a[6] != a[1] || a[2] + a[3] != a[1] || d == 1) {
    cout << -1;
    return 0;
  } else {
    if (a[4] > a[2]) {
      cout << -1;
      return 0;
    } else {
      a[2] -= a[4];
      if (a[2] + a[3] != a[6]) {
        cout << -1;
        return 0;
      } else
        for (i = 0; i < a[4]; i++) cout << 1 << " " << 2 << " " << 4 << endl;
      for (i = 0; i < a[2]; i++) cout << 1 << " " << 2 << " " << 6 << endl;
      for (i = 0; i < a[3]; i++) cout << 1 << " " << 3 << " " << 6 << endl;
    }
  }
}
