#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int n;
  cin >> n;
  vector<int> v(n + 1);
  for (int i = 1; i <= n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  int cnt1 = n / 3, cnt2 = n / 3 * 2;
  for (int i = 1; i <= n / 3; i++) {
    if (v[cnt1 + i] % v[i] == 0 && v[cnt2 + i] % v[cnt1 + i] == 0 &&
        v[cnt1 + i] > v[i] && v[cnt2 + i] > v[cnt1 + i])
      continue;
    else {
      cout << -1;
      return 0;
    }
  }
  for (int i = 1; i <= n / 3; i++) {
    cout << v[i] << ' ' << v[cnt1 + i] << ' ' << v[cnt2 + i] << '\n';
  }
}
