#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
char maze[1001][1001];
int main() {
  fast();
  int num, one = 0, two = 0, there = 0, six = 0, fou = 0;
  cin >> num;
  ;
  for (int i = 0; i < num; i++) {
    int x;
    cin >> x;
    one += bool(x == 1);
    two += bool(x == 2);
    there += bool(x == 3);
    fou += bool(x == 4);
    six += bool(x == 6);
  }
  if ((fou + six) != num / 3 || (one) != num / 3 || (two + there) != num / 3) {
    cout << -1 << endl;
    return 0;
  }
  vector<string> vs;
  for (int i = 0; i < num / 3; i++) {
    string s = "";
    s += '1';
    s += ' ';
    if (there == six && six && there) {
      s += '3', s += ' ', s += '6';
      six--, there--;
    } else if (two) {
      s += '2';
      s += ' ';
      if (fou)
        s += '4', fou--;
      else if (six)
        s += '6', six--;
      else {
        cout << -1 << endl;
        return 0;
      }
      two--;
    } else {
      cout << -1 << endl;
      return 0;
    }
    vs.push_back(s);
  }
  for (int i = 0; i < vs.size(); i++) {
    cout << vs[i] << endl;
  }
  return 0;
}
