#include <bits/stdc++.h>
using namespace std;
int cont[13];
int main() {
  int n;
  cin >> n;
  bool pod = true;
  int m;
  for (int i = 0; i < n; i++) {
    cin >> m;
    if (m == 5 || m == 7) pod = false;
    cont[m]++;
  }
  if (!pod)
    cout << -1 << endl;
  else {
    if (cont[4] > cont[2]) pod = false;
    if (cont[4] > cont[1]) pod = false;
    int unos = cont[1] - cont[4];
    int dos = cont[2] - cont[4];
    if (cont[6] != unos || (cont[6] != dos + cont[3])) pod = false;
    if (!pod) {
      cout << -1 << endl;
      return 0;
    }
    for (int i = 0; i < cont[4]; i++) cout << 1 << " " << 2 << " " << 4 << endl;
    for (int i = 0; i < dos; i++) cout << 1 << " " << 2 << " " << 6 << endl;
    for (int i = 0; i < cont[3]; i++) cout << 1 << " " << 3 << " " << 6 << endl;
  }
  return 0;
}
