#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100000];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < n / 3; i++)
    if (a[i] >= a[i + n / 3] || a[i + n / 3] >= a[i + (n / 3) * 2] ||
        a[i + n / 3] % a[i] || a[i + (n / 3) * 2] % a[i + n / 3]) {
      cout << -1 << endl;
      return 0;
    }
  for (int i = 0; i < n / 3; i++) {
    cout << a[i] << " " << a[i + n / 3] << " " << a[i + (n / 3) * 2] << endl;
  }
  return 0;
}
