#include <bits/stdc++.h>
using namespace std;
int arr[8];
int main() {
  long long n;
  cin >> n;
  long long xtmp;
  for (int i = 0; i < n; ++i) {
    cin >> xtmp;
    if (xtmp != 1 && xtmp != 2 && xtmp != 3 && xtmp != 4 && xtmp != 6) {
      cout << -1;
      return 0;
    }
    arr[xtmp] += 1;
  }
  string s1 = "1 2 4 \n";
  string s2 = "1 2 6 \n";
  string s3 = "1 3 6 \n";
  long long i1 = 0, i2 = 0, i3 = 0;
  while (arr[4] > 0) {
    arr[4]--;
    if (arr[1] == 0 || arr[2] == 0) {
      cout << -1;
      return 0;
    }
    arr[1]--;
    arr[2]--;
    i1++;
  }
  while (arr[3] > 0) {
    arr[3]--;
    if (arr[1] == 0 || arr[6] == 0) {
      cout << -1;
      return 0;
    }
    arr[1]--;
    arr[6]--;
    i3++;
  }
  while (arr[2] > 0) {
    arr[2]--;
    if (arr[1] == 0 || arr[6] == 0) {
      cout << -1;
      return 0;
    }
    arr[1]--;
    arr[6]--;
    i2++;
  }
  for (int k = 0; k <= 7; ++k) {
    if (arr[k] != 0) {
      cout << -1;
      return 0;
    }
  }
  for (int j = 0; j < i1; ++j) {
    cout << s1;
  }
  for (int j = 0; j < i2; ++j) {
    cout << s2;
  }
  for (int j = 0; j < i3; ++j) {
    cout << s3;
  }
  if (i3 == 0 && i2 == 0 && i1 == 0) {
    cout << -1;
  }
  return 0;
}
