#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n;
int cnt[10];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (long long int i = 0; i < int(n); ++i) {
    int t;
    cin >> t;
    cnt[t]++;
  }
  vector<pair<pair<int, int>, int> > ans;
  int v = min(cnt[3], cnt[6]);
  ans.push_back(make_pair(make_pair(3, 6), v));
  cnt[3] -= v;
  cnt[6] -= v;
  cnt[1] -= v;
  v = min(cnt[2], cnt[6]);
  ans.push_back(make_pair(make_pair(2, 6), v));
  cnt[2] -= v;
  cnt[6] -= v;
  cnt[1] -= v;
  v = min(cnt[2], cnt[4]);
  ans.push_back(make_pair(make_pair(2, 4), v));
  cnt[2] -= v;
  cnt[4] -= v;
  cnt[1] -= v;
  for (int i = 1; i <= 7; ++i) {
    if (cnt[i] != 0) {
      cout << -1;
      return 0;
    }
  }
  for (int i = 0; i < ans.size(); ++i) {
    for (int k = 0; k < ans[i].second; ++k) {
      cout << 1 << " " << ans[i].first.first << " " << ans[i].first.second
           << endl;
    }
  }
  return 0;
}
