#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long int s1 = 0;
  long long int s2 = 0;
  long long int s3 = 0;
  long long int s4 = 0;
  long long int s6 = 0;
  for (long long int k = 1; k <= n; k++) {
    if (a[k] == 1) {
      s1 = s1 + 1;
    }
    if (a[k] == 2) {
      s2 = s2 + 1;
    }
    if (a[k] == 3) {
      s3 = s3 + 1;
    }
    if (a[k] == 4) {
      s4 = s4 + 1;
    }
    if (a[k] == 6) {
      s6 = s6 + 1;
    }
  }
  if (s1 + s2 + s3 + s4 + s6 < n) {
    cout << "-1";
  } else {
    s1 = s1 - s4;
    s2 = s2 - s4;
    if ((s1 < 0) || (s2 < 0)) {
      cout << "-1";
    } else {
      if ((s6 != s1) || (s6 != s2 + s3)) {
        cout << "-1";
      } else {
        for (long long int m = 1; m <= s4; m++) {
          cout << "1"
               << " "
               << "2"
               << " "
               << "4" << endl;
        }
        for (long long int m3 = 1; m3 <= s3; m3++) {
          cout << "1"
               << " "
               << "3"
               << " "
               << "6" << endl;
        }
        for (long long int m4 = 1; m4 <= s2; m4++) {
          cout << "1"
               << " "
               << "2"
               << " "
               << "6" << endl;
        }
      }
    }
  }
  return 0;
}
