#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long xor1_n(long long n) {
  switch (n % 4) {
    case 0:
      return n;
    case 1:
      return 1;
    case 2:
      return n + 1;
  }
  return 0;
}
int ncr(int n, int r) {
  int res = 1;
  if (r > n - r) r = n - r;
  for (int i = 0; i < r; i++) {
    res *= n - i;
    res /= i + 1;
  }
  return res;
}
clock_t time_p = clock();
void rtime() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
long long power(long long a, long long b, long long m = mod) {
  long long ans = 1;
  a = a % m;
  while (b > 0) {
    if (b & 1) ans = (1ll * a * ans) % m;
    b >>= 1;
    a = (1ll * a * a) % m;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    int h[10] = {0}, a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      h[a[i]]++;
    }
    int k = n / 3;
    int ok = 0;
    if (h[1] == k && h[2] + h[3] == k && h[4] + h[6] == k && h[4] <= h[2] &&
        h[3] <= h[6]) {
      for (int i = 0; i < h[3]; i++) cout << "1 3 6\n";
      for (int i = 0; i < h[4]; i++) cout << "1 2 4\n";
      h[2] -= h[4];
      for (int i = 0; i < h[2]; i++) cout << "1 2 6\n";
    } else
      cout << -1;
  }
  rtime();
  return 0;
}
