#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int n, m;
int cnt[10];
vector<pair<int, pair<int, int> > > v;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    cnt[x]++;
  }
  for (int i = 1; i <= cnt[4]; i++) {
    v.push_back({1, {2, 4}});
    if (cnt[1] == 0) return cout << "-1" << endl, 0;
    if (cnt[2] == 0) return cout << "-1" << endl, 0;
    cnt[1]--;
    cnt[2]--;
    n -= 3;
  }
  cnt[4] = 0;
  if (cnt[1] != cnt[6] || (cnt[2] + cnt[3]) != (cnt[6])) {
    cout << "-1" << endl;
    return 0;
  }
  for (int i = 1; i <= cnt[2]; i++) {
    v.push_back({1, {2, 6}});
    n -= 3;
  }
  for (int i = 1; i <= cnt[3]; i++) {
    v.push_back({1, {3, 6}});
    n -= 3;
  }
  if (n != 0) return cout << -1 << endl, 0;
  for (auto temp : v) {
    cout << temp.first << ' ' << temp.second.first << ' ' << temp.second.second
         << endl;
  }
  return 0;
}
