#include <bits/stdc++.h>
using namespace std;
void pl(long long a) { printf("%lld\n", a); }
void pll(long long a, long long b) { printf("%lld %lld\n", a, b); }
void plll(long long a, long long b, long long c) {
  printf("%lld %lld %lld ", a, b, c);
}
void sss(string s) { cout << s, printf("\n"); }
long long string_to_ll(string s) {
  stringstream ss;
  ss << s;
  long long n;
  ss >> n;
  return n;
}
string ll_to_string(long long n) {
  stringstream ss;
  ss << n;
  string s;
  ss >> s;
  return s;
}
int n, ara[1000005], i, a, flag, aa, bb, cc;
int main() {
  scanf("%d", &n);
  a = n / 3;
  for (int i = 0; i < (int)n; i++) scanf("%d", &ara[i]);
  sort(ara, ara + n);
  for (int i = 0; i < (int)a; i++) {
    aa = ara[i];
    bb = ara[i + a];
    cc = ara[i + a + a];
    if (bb % aa != 0 || cc % bb != 0 || aa >= bb || bb >= cc) {
      flag = 1;
      break;
    }
  }
  if (flag)
    sss("-1");
  else {
    for (int i = 0; i < (int)a; i++) {
      printf("%d %d %d\n", ara[i], ara[i + a], ara[i + 2 * a]);
    }
  }
  return 0;
}
