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