Problem: When they are bored, Federico and Giada often play the following card game with a deck containing 6n cards.

Each card contains one number between 1 and 6n and each number appears on exactly one card. Initially the deck is sorted, so the first card contains the number 1, the second card contains the number 2, ..., and the last one contains the number 6n.

Federico and Giada take turns, alternating; Federico starts.

In his turn, the player takes 3 contiguous cards from the deck and puts them in his pocket. The order of the cards remaining in the deck is not changed. They play until the deck is empty (after exactly 2n turns). At the end of the game both Federico and Giada have 3n cards in their pockets.

You are given the cards in Federico's pocket at the end of the game. Describe a sequence of moves that produces that set of cards in Federico's pocket.

Input

The first line of the input contains one integer n (1≤ n ≤ 200).

The second line of the input contains 3n numbers x_1, x_2,…, x_{3n} (1 ≤ x_1 < x_2 <… < x_{3n} ≤ 6n) – the cards in Federico's pocket at the end of the game. 

It is guaranteed that for each test there is at least one sequence of moves that produces such set of cards in Federico's pocket.

Output

Print 2n lines, each containing 3 integers.

The i-th line should contain, in increasing order, the integers a_i<b_i<c_i written on the three cards taken by the player during the i-th turn (so taken by Federico if i is odd and by Giada if i is even).

If there is more than one possible sequence of moves, you can print any.

Examples

Input


2
2 3 4 9 10 11


Output


9 10 11
6 7 8
2 3 4
1 5 12


Input


5
1 2 3 4 5 9 11 12 13 18 19 20 21 22 23


Output


19 20 21
24 25 26
11 12 13
27 28 29
1 2 3
14 15 16
18 22 23
6 7 8
4 5 9
10 17 30

Note

Explanation of the first testcase: Initially the deck has 12 = 2⋅ 6 sorted cards, so the deck is [1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12]. 

  * During turn 1, Federico takes the three cards [9\ 10\ 11]. After his move, the deck is [1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 12]. 
  * During turn 2, Giada takes the three cards [6\ 7\ 8]. After her move, the deck is [1\ 2\ 3\ 4\ 5\ 12]. 
  * During turn 3, Federico takes the three cards [2\ 3\ 4]. After his move, the deck is [1\ 5\ 12]. 
  * During turn 4, Giada takes the three cards [1\ 5\ 12]. After her move, the deck is empty. 

At the end of the game, the cards in Federico's pocket are [2\ 3\ 4\ 9\ 10\ 11] and the cards in Giada's pocket are [1\ 5\ 6\ 7\ 8\ 12].

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using db = double;
using str = string;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<db, db>;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<db>;
using vs = vector<str>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;
template <class T>
using V = vector<T>;
template <class T, size_t SZ>
using AR = array<T, SZ>;
const int MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int xd[4] = {1, 0, -1, 0}, yd[4] = {0, 1, 0, -1};
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int bits(int x) { return 31 - __builtin_clz(x); }
ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); }
ll fdiv(ll a, ll b) { return a / b - ((a ^ b) < 0 && a % b); }
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
template <class T, class U>
T fstTrue(T lo, T hi, U first) {
  hi++;
  assert(lo <= hi);
  while (lo < hi) {
    T mid = lo + (hi - lo) / 2;
    first(mid) ? hi = mid : lo = mid + 1;
  }
  return lo;
}
template <class T, class U>
T lstTrue(T lo, T hi, U first) {
  lo--;
  assert(lo <= hi);
  while (lo < hi) {
    T mid = lo + (hi - lo + 1) / 2;
    first(mid) ? lo = mid : hi = mid - 1;
  }
  return lo;
}
template <class T>
void remDup(vector<T>& v) {
  sort(begin(v), end(v));
  v.erase(unique(begin(v), end(v)), end(v));
}
template <class T, class U>
void erase(T& t, const U& u) {
  auto it = t.find(u);
  assert(it != end(t));
  t.erase(u);
}
template <class T>
void re(complex<T>& c);
template <class T, class U>
void re(pair<T, U>& p);
template <class T>
void re(vector<T>& v);
template <class T, size_t SZ>
void re(AR<T, SZ>& a);
template <class T>
void re(T& x) {
  cin >> x;
}
void re(db& d) {
  str t;
  re(t);
  d = stod(t);
}
void re(ld& d) {
  str t;
  re(t);
  d = stold(t);
}
template <class T, class... U>
void re(T& t, U&... u) {
  re(t);
  re(u...);
}
template <class T>
void re(complex<T>& c) {
  T a, b;
  re(a, b);
  c = {a, b};
}
template <class T, class U>
void re(pair<T, U>& p) {
  re(p.first, p.second);
}
template <class T>
void re(vector<T>& x) {
  for (auto& a : x) re(a);
}
template <class T, size_t SZ>
void re(AR<T, SZ>& x) {
  for (auto& a : x) re(a);
}
str to_string(char c) { return str(1, c); }
str to_string(const char* second) { return (str)second; }
str to_string(str second) { return second; }
str to_string(bool b) { return to_string((int)b); }
template <class T>
str to_string(complex<T> c) {
  stringstream ss;
  ss << c;
  return ss.str();
}
str to_string(vector<bool> v) {
  str res = "{";
  for (int i = (0); i < ((int)(v).size()); ++i) res += char('0' + v[i]);
  res += "}";
  return res;
}
template <size_t SZ>
str to_string(bitset<SZ> b) {
  str res = "";
  for (int i = (0); i < (SZ); ++i) res += char('0' + b[i]);
  return res;
}
template <class T, class U>
str to_string(pair<T, U> p);
template <class T>
str to_string(T v) {
  bool fst = 1;
  str res = "";
  for (const auto& x : v) {
    if (!fst) res += " ";
    fst = 0;
    res += to_string(x);
  }
  return res;
}
template <class T, class U>
str to_string(pair<T, U> p) {
  return to_string(p.first) + " " + to_string(p.second);
}
template <class T>
void pr(T x) {
  cout << to_string(x);
}
template <class T, class... U>
void pr(const T& t, const U&... u) {
  pr(t);
  pr(u...);
}
void ps() { pr("\n"); }
template <class T, class... U>
void ps(const T& t, const U&... u) {
  pr(t);
  if (sizeof...(u)) pr(" ");
  ps(u...);
}
void DBG() { cerr << "]" << endl; }
template <class T, class... U>
void DBG(const T& t, const U&... u) {
  cerr << to_string(t);
  if (sizeof...(u)) cerr << ", ";
  DBG(u...);
}
void setIn(str second) { freopen(second.c_str(), "r", stdin); }
void setOut(str second) { freopen(second.c_str(), "w", stdout); }
void unsyncIO() { cin.tie(0)->sync_with_stdio(0); }
void setIO(str second = "") {
  unsyncIO();
  if ((int)(second).size()) {
    setIn(second + ".in"), setOut(second + ".out");
  }
}
int n;
vi x;
int cool[1200][1200];
int col[1200];
bool get(int l, int r) {
  if (l > r) return 1;
  return cool[l][r];
}
V<AR<int, 3>> trip[2];
const AR<int, 3> ID = {-1, -1, -1};
bool lef[1200];
int nex[1200];
bool match(int a, pi b) {
  if (b.first > b.second) return 0;
  return col[a] == col[b.first];
}
bool ok[1201][2];
pi pre[1201][2];
bool rooted[1201];
void oops(int i, int j) {
  if (col[i] != col[j]) return;
  for (int k = i + 2; k < j; k += 3)
    if (col[k] == col[k + 1]) cool[i][j] |= get(i, k) & get(k + 1, j);
  for (int k = i + 1; k < j; k += 3)
    if (col[i] == col[k] && !match(i, {i + 1, k - 1}) &&
        !match(i, {k + 1, j - 1}))
      cool[i][j] |= get(i + 1, k - 1) & get(k + 1, j - 1);
}
void gen(int i, int j, int start = 0) {
  if (i > j) return;
  assert(cool[i][j] && col[i] == col[j]);
  for (int k = i + 2; k < j; k += 3)
    if (col[k] == col[k + 1])
      if (get(i, k) && get(k + 1, j)) {
        assert(!start);
        gen(i, k);
        gen(k + 1, j);
        return;
      }
  for (int k = i + 1; k < j; k += 3)
    if (col[i] == col[k] && !match(i, {i + 1, k - 1}) &&
        !match(i, {k + 1, j - 1}))
      if (get(i + 1, k - 1) && get(k + 1, j - 1)) {
        trip[col[i]].push_back({i, k, j});
        gen(i + 1, k - 1);
        gen(k + 1, j - 1);
        return;
      }
  assert(0);
}
int main() {
  setIO();
  re(n);
  x.resize(3 * n);
  re(x);
  for (int i = (0); i < (6 * n); ++i) col[i] = 1;
  for (auto& t : x) {
    t--;
    col[t] = 0;
  }
  for (int i = (6 * n) - 1; i >= (0); --i)
    for (int j = i + 2; j < 6 * n; j += 3) {
      oops(i, j);
    }
  ok[0][0] = 1;
  for (int i = (0); i < (6 * n); ++i)
    for (int p = (0); p < (2); ++p)
      if (ok[i][p])
        for (int j = (i + 1); j < (6 * n + 1); ++j)
          if (cool[i][j - 1]) {
            int P = p | col[i];
            ok[j][P] = 1;
            pre[j][P] = {i, p};
          }
  assert(ok[6 * n][1]);
  vi ends;
  pi cur = {6 * n, 1};
  while (cur.first) {
    ends.push_back(cur.first);
    cur = pre[cur.first][cur.second];
  }
  ends.push_back(0);
  reverse(begin(ends), end(ends));
  for (int i = (0); i < ((int)(ends).size() - 1); ++i)
    gen(ends[i], ends[i + 1] - 1, 1);
  for (auto& t : ends) rooted[t] = 1;
  for (int j = (0); j < (6 * n); ++j) lef[j] = 1;
  for (int i = (0); i < (2 * n); ++i) {
    int lst = -1;
    for (int j = (0); j < (6 * n); ++j)
      if (lef[j]) {
        if (lst != -1) nex[lst] = j;
        lst = j;
      }
    AR<int, 3> test = ID;
    for (auto& t : trip[i & 1])
      if (nex[t[0]] == t[1] && nex[t[1]] == t[2] && !rooted[t[0]]) test = t;
    if (test == ID) {
      for (auto& t : trip[i & 1])
        if (nex[t[0]] == t[1] && nex[t[1]] == t[2] && rooted[t[0]]) test = t;
    }
    assert(test != ID);
    trip[i & 1].erase(find(begin(trip[i & 1]), end(trip[i & 1]), test));
    lef[test[0]] = lef[test[1]] = lef[test[2]] = 0;
    ps(test[0] + 1, test[1] + 1, test[2] + 1);
  }
}