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;
std::mt19937 rnd(
    (int)std::chrono::steady_clock::now().time_since_epoch().count());
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 200;
const int MAXCARD = 6 * MAXN;
int n, ncard;
int col[MAXCARD];
vector<vector<int>> ans;
bool can[MAXCARD][MAXCARD];
int prv[MAXCARD + 1][4];
vector<vector<int>> lst;
vector<int> par;
vector<vector<int>> ch;
vector<bool> done;
vector<int> rem;
void build(int s, int t) {
  vector<pair<int, vector<int>>> stck;
  for (int i = (s); i <= (t); ++i) {
    if (stck.empty() || stck.back().first != col[i]) {
      stck.push_back(make_pair(col[i], vector<int>(1, i)));
    } else {
      stck.back().second.push_back(i);
      if (((int)(stck.back().second).size()) == 3) {
        vector<int> cur = stck.back().second;
        lst.push_back(cur);
        stck.pop_back();
      }
    }
  }
  assert(((int)(stck).size()) == 0);
}
bool inside(const vector<int>& a, const vector<int>& b) {
  bool pos1 = true, pos2 = true;
  for (int i = (0); i < (((int)(a).size())); ++i) {
    if (a[i] < b[0] || a[i] > b[1]) pos1 = false;
    if (a[i] < b[1] || a[i] > b[2]) pos2 = false;
  }
  return pos1 || pos2;
}
bool conflicting(const vector<int>& a, const vector<int>& b) {
  if (inside(a, b) || inside(b, a)) return false;
  if (a[2] < b[0] || b[2] < a[0]) return false;
  return true;
}
void solve() {
  for (int s = (0); s < (ncard); ++s) {
    vector<pair<int, int>> stck;
    for (int i = (s); i < (ncard); ++i) {
      if (stck.empty() || stck.back().first != col[i])
        stck.push_back(make_pair(col[i], 1));
      else if (stck.back().second == 2)
        stck.pop_back();
      else
        ++stck.back().second;
      can[s][i] = stck.empty();
    }
  }
  for (int i = (0); i <= (ncard); ++i)
    for (int j = (0); j <= (3); ++j) prv[i][j] = -2;
  for (int i = (0); i < (ncard); ++i)
    if (col[i] == 1 && (i == 0 || can[0][i - 1])) prv[i][0] = -1;
  for (int i = (0); i < (ncard); ++i)
    for (int j = (0); j < (3); ++j)
      if (prv[i][j] != -2) {
        for (int k = (i + 1); k <= (ncard); ++k)
          if ((k == ncard || col[k] == 1) && (k == i + 1 || can[i + 1][k - 1]))
            prv[k][j + 1] = i;
      }
  assert(prv[ncard][3] != -2);
  vector<int> last;
  for (int i = prv[ncard][3], j = 2; i != -1; i = prv[i][j], --j)
    last.push_back(i);
  reverse(last.begin(), last.end());
  lst.clear();
  for (int j = (0); j <= (3); ++j) {
    int s = j == 0 ? 0 : last[j - 1] + 1;
    int t = j == 3 ? ncard - 1 : last[j] - 1;
    if (s <= t) build(s, t);
  }
  lst.push_back(last);
  int lastid = ((int)(lst).size()) - 1;
  assert(((int)(lst).size()) == ncard / 3);
  ch = vector<vector<int>>(((int)(lst).size()));
  par = vector<int>(((int)(lst).size()), -1);
  for (int i = (0); i < (((int)(lst).size())); ++i)
    for (int j = (i + 1); j < (((int)(lst).size())); ++j) {
      assert(!conflicting(lst[i], lst[j]));
      assert(!inside(lst[j], lst[i]));
      if (inside(lst[i], lst[j])) {
        bool direct = true;
        for (int k = (i + 1); k < (j); ++k)
          if (inside(lst[i], lst[k]) && inside(lst[k], lst[j])) {
            direct = false;
            break;
          }
        if (direct) {
          par[i] = j;
          ch[j].push_back(i);
        }
      }
    }
  rem = vector<int>(((int)(lst).size()), 0);
  for (int i = (0); i < (((int)(lst).size())); ++i)
    rem[i] = ((int)(ch[i]).size());
  done = vector<bool>(((int)(lst).size()), false);
  ans.clear();
  for (int i = (0); i < (((int)(lst).size())); ++i) {
    int c = i % 2;
    int use = -1;
    for (int j = (0); j < (((int)(lst).size())); ++j)
      if (!done[j] && col[lst[j][0]] == c && rem[j] == 0) {
        use = j;
        break;
      }
    assert(use != -1);
    done[use] = true;
    if (par[use] != -1) --rem[par[use]];
    ans.push_back(lst[use]);
  }
}
void run() {
  scanf("%d", &n);
  ncard = 6 * n;
  for (int i = (0); i < (ncard); ++i) col[i] = 1;
  for (int i = (0); i < (3 * n); ++i) {
    int x;
    scanf("%d", &x);
    --x;
    col[x] = 0;
  }
  solve();
  for (int i = (0); i < (((int)(ans).size())); ++i) {
    for (int j = (0); j < (((int)(ans[i]).size())); ++j) {
      if (j != 0) printf(" ");
      printf("%d", ans[i][j] + 1);
    }
    puts("");
  }
}
int main() {
  run();
  return 0;
}