#include <bits/stdc++.h>
using namespace std;
int n, k, i, x;
int arr[10];
map<int, int> maap;
int main() {
  int n, a;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    arr[a]++;
  }
  n /= 3;
  if (arr[1] == n && arr[2] + arr[3] == n && arr[2] >= arr[4] &&
      arr[4] + arr[6] == n && arr[6] >= arr[3]) {
    for (; arr[4] > 0;) {
      cout << "1 2 4\n";
      arr[4]--;
      arr[2]--;
      ;
    }
    for (; arr[3] > 0;) {
      cout << "1 3 6\n";
      arr[3]--;
    }
    for (; arr[2] > 0;) {
      cout << "1 2 6\n";
      arr[2]--;
    }
  } else
    cout << -1 << endl;
}
