#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  while (cin >> n) {
    int ok = 1;
    int tot1 = 0, tot2 = 0, tot3 = 0, tot4 = 0, tot6 = 0;
    int temp;
    for (int i = 0; i < n; i++) {
      scanf("%d", &temp);
      if (temp == 1)
        tot1++;
      else if (temp == 2)
        tot2++;
      else if (temp == 3)
        tot3++;
      else if (temp == 4)
        tot4++;
      else if (temp == 6)
        tot6++;
      else
        ok = 0;
    }
    if (!ok)
      cout << -1 << endl;
    else {
      if (tot2 < tot4)
        cout << -1 << endl;
      else if (tot6 < tot3)
        cout << -1 << endl;
      else if (tot1 != tot2 + tot3)
        cout << -1 << endl;
      else if (tot1 != tot4 + tot6)
        cout << -1 << endl;
      else {
        for (int i = 0; i < tot4; i++) printf("1 2 4\n");
        for (int i = 0; i < tot3; i++) printf("1 3 6\n");
        for (int i = 0; i < tot1 - tot4 - tot3; i++) printf("1 2 6\n");
      }
    }
  }
  return 0;
}
