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>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,mmx,avx")
using namespace std;
const int MOD = 1000000007;
const int UNDEF = -1;
const int INF = 1 << 30;
template <typename T>
inline bool chkmax(T &aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T &aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
template <typename T>
void makeunique(vector<T> &vx) {
  sort(vx.begin(), vx.end());
  auto it = unique(vx.begin(), vx.end());
  vx.resize(std::distance(vx.begin(), it));
}
int rint();
char rch();
long long rlong();
const int mn = 202;
bitset<6 * mn> inp;
int pre[6 * mn];
int good[6 * mn][6 * mn];
int type[6 * mn][6 * mn];
struct S {
  S() {}
  S(int _li, int _ri, int _src) : li(_li), ri(_ri), src(_src) {}
  int li, ri, src;
};
S f[2 * mn][2 * mn][2];
struct Elem {
  Elem(int _e0, int _e1, int _e2) { e[0] = _e0, e[1] = _e1, e[2] = _e2; }
  int e[3];
};
struct Group {
  vector<Elem> v;
};
const int EMPTY = 1, SPLIT = 2, TRIPLE = 3;
int getcnt(int l, int r) { return pre[r] - pre[l - 1]; }
Group go(int l, int r) {
  int mid = good[l][r];
  Group gl, gr, ans;
  Elem triple(-1, -1, -1);
  if (type[l][r] == EMPTY) {
    return ans;
  }
  if (type[l][r] == SPLIT) {
    gl = go(l, mid - 1);
    gr = go(mid, r);
  } else if (type[l][r] == TRIPLE) {
    gl = go(l + 1, mid - 1);
    gr = go(mid + 1, r - 1);
    triple = Elem(l, mid, r);
  } else
    assert(0);
  int bias = getcnt(l, r) > (r - l + 1) / 2 ? 1 : 0;
  int sl = gl.v.size(), sr = gr.v.size();
  for (int attempt = 0; attempt < 2; attempt++) {
    for (int li = 0; li <= sl; li++) {
      for (int ri = 0; ri <= sr; ri++) {
        for (int src = 0; src < 2; src++) {
          f[li][ri][src].li = -1;
        }
      }
    }
    if (attempt == 1) {
      f[0][0][0] = S(0, 0, 0);
      f[0][0][1] = S(0, 0, 0);
    } else {
      if (0 < sl && inp[gl.v[0].e[0]]) f[1][0][1] = S(0, 0, 0);
      if (0 < sr && inp[gr.v[0].e[0]]) f[0][1][1] = S(0, 0, 0);
    }
    for (int li = 0; li <= sl; li++) {
      for (int ri = 0; ri <= sr; ri++) {
        if (li < sl) {
          int t = inp[gl.v[li].e[0]];
          for (int src = 0; src < 2; src++) {
            if (f[li][ri][src].li != -1) {
              if (t != src || t == bias) f[li + 1][ri][t] = S(li, ri, src);
            }
          }
        }
        if (ri < sr) {
          int t = inp[gr.v[ri].e[0]];
          for (int src = 0; src < 2; src++) {
            if (f[li][ri][src].li != -1) {
              if (t != src || t == bias) f[li][ri + 1][t] = S(li, ri, src);
            }
          }
        }
      }
    }
    for (int src = 0; src < 2; src++) {
      if (f[sl][sr][src].li != -1) {
        if (triple.e[0] != -1) {
          int t = inp[triple.e[0]];
          if (!(t != src || t == bias)) continue;
          ans.v.push_back(triple);
        }
        S now(sl, sr, src);
        for (int i = 0; i < sl + sr; i++) {
          S prev = f[now.li][now.ri][now.src];
          if (prev.li == now.li - 1)
            ans.v.push_back(gl.v[prev.li]);
          else if (prev.ri == now.ri - 1)
            ans.v.push_back(gr.v[prev.ri]);
          else
            assert(0);
          now = prev;
        }
        reverse(ans.v.begin(), ans.v.end());
        return ans;
      }
    }
  }
  assert(0);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n = rint();
  for (int i = 0; i < 3 * n; i++) {
    int x = rint();
    inp[x] = true;
    pre[x] = 1;
  }
  for (int x = 1; x <= 6 * n; x++) pre[x] += pre[x - 1];
  memset(good, -1, sizeof good);
  for (int x = 1; x <= 6 * n + 1; x++) {
    good[x][x - 1] = x;
    type[x][x - 1] = EMPTY;
  }
  for (int len = 3; len <= 6 * n; len += 3) {
    for (int l = 1; l <= 6 * n - (len - 1); l++) {
      int r = l + (len - 1);
      for (int x = l + 3; x <= r - 2; x += 3) {
        if (good[l][x - 1] != -1 && good[x][r] != -1) {
          good[l][r] = x;
          type[l][r] = SPLIT;
        }
      }
      if (good[l][r] == -1 && inp[l] == inp[r]) {
        for (int x = l + 1; x <= r - 1; x += 3) {
          if (inp[x] == inp[l] && good[l + 1][x - 1] != -1 &&
              good[x + 1][r - 1] != -1) {
            good[l][r] = x;
            type[l][r] = TRIPLE;
            break;
          }
        }
      }
    }
  }
  assert(good[1][6 * n]);
  Group final = go(1, 6 * n);
  for (auto &w : final.v) {
    printf("%d %d %d\n", w.e[0], w.e[1], w.e[2]);
  }
}
static char stdinBuffer[1024];
static char *stdinDataEnd = stdinBuffer + sizeof(stdinBuffer);
static const char *stdinPos = stdinDataEnd;
void readAhead(size_t amount) {
  size_t remaining = stdinDataEnd - stdinPos;
  if (remaining < amount) {
    memmove(stdinBuffer, stdinPos, remaining);
    size_t sz = fread(stdinBuffer + remaining, 1,
                      sizeof(stdinBuffer) - remaining, stdin);
    stdinPos = stdinBuffer;
    stdinDataEnd = stdinBuffer + remaining + sz;
    if (stdinDataEnd != stdinBuffer + sizeof(stdinBuffer)) *stdinDataEnd = 0;
  }
}
int rint() {
  readAhead(16);
  int x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
char rch() {
  readAhead(16);
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  char ans = *stdinPos;
  ++stdinPos;
  return ans;
}
long long rlong() {
  readAhead(32);
  long long x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}