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 lint = long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios {
  fast_ios() {
    cin.tie(nullptr), ios::sync_with_stdio(false),
        cout << fixed << setprecision(20);
  };
} fast_ios_;
template <typename T, typename V>
void ndarray(vector<T> &vec, const V &val, int len) {
  vec.assign(len, val);
}
template <typename T, typename V, typename... Args>
void ndarray(vector<T> &vec, const V &val, int len, Args... args) {
  vec.resize(len),
      for_each(begin(vec), end(vec), [&](T &v) { ndarray(v, val, args...); });
}
template <typename T>
bool chmax(T &m, const T q) {
  if (m < q) {
    m = q;
    return true;
  } else
    return false;
}
template <typename T>
bool chmin(T &m, const T q) {
  if (m > q) {
    m = q;
    return true;
  } else
    return false;
}
template <typename T1, typename T2>
pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) {
  return make_pair(l.first + r.first, l.second + r.second);
}
template <typename T1, typename T2>
pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) {
  return make_pair(l.first - r.first, l.second - r.second);
}
template <typename T>
vector<T> srtunq(vector<T> vec) {
  sort(vec.begin(), vec.end()),
      vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << '[';
  for (auto v : vec) os << v << ',';
  os << ']';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const deque<T> &vec) {
  os << "deq[";
  for (auto v : vec) os << v << ',';
  os << ']';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &vec) {
  os << '{';
  for (auto v : vec) os << v << ',';
  os << '}';
  return os;
}
template <typename T, typename TH>
ostream &operator<<(ostream &os, const unordered_set<T, TH> &vec) {
  os << '{';
  for (auto v : vec) os << v << ',';
  os << '}';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &vec) {
  os << '{';
  for (auto v : vec) os << v << ',';
  os << '}';
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const unordered_multiset<T> &vec) {
  os << '{';
  for (auto v : vec) os << v << ',';
  os << '}';
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &pa) {
  os << '(' << pa.first << ',' << pa.second << ')';
  return os;
}
template <typename TK, typename TV>
ostream &operator<<(ostream &os, const map<TK, TV> &mp) {
  os << '{';
  for (auto v : mp) os << v.first << "=>" << v.second << ',';
  os << '}';
  return os;
}
template <typename TK, typename TV, typename TH>
ostream &operator<<(ostream &os, const unordered_map<TK, TV, TH> &mp) {
  os << '{';
  for (auto v : mp) os << v.first << "=>" << v.second << ',';
  os << '}';
  return os;
}
int main() {
  int N;
  cin >> N;
  vector<int> Color(N * 6 + 1, 0);
  for (int _ = (0), __end_ = (N * 3); _ < __end_; _++) {
    int a;
    cin >> a;
    Color[a] = 1;
  }
  vector<pint> P;
  for (int i = (1), i_end_ = (N * 6 + 1); i < i_end_; i++)
    P.emplace_back(i, Color[i]);
  sort((P).begin(), (P).end());
  vector<vector<int>> T10;
  while (P.size()) {
    vector<int> used(P.size());
    for (int j = (0), j_end_ = (P.size() - 2); j < j_end_; j++) {
      if (P[j].second == P[j + 1].second and P[j].second == P[j + 2].second) {
        T10.push_back({P[j].first, P[j + 1].first, P[j + 2].first});
        for (int d = (0), d_end_ = (3); d < d_end_; d++) used[j + d] = true;
        break;
        j += 2;
      }
    }
    vector<pint> Pnew;
    for (int i = (0), i_end_ = (used.size()); i < i_end_; i++)
      if (!used[i]) Pnew.emplace_back(P[i]);
    P = Pnew;
  }
  sort((T10).begin(), (T10).end(),
       [](const vector<int> &l, const vector<int> &r) {
         return l.back() - l[0] < r.back() - r[0];
       });
  vector<int> cs;
  for (auto v : T10) cs.emplace_back(Color[v[0]]);
  vector<set<int>> chi(cs.size());
  vector<int> par(cs.size(), -1);
  for (int i = (0), i_end_ = (cs.size()); i < i_end_; i++) {
    for (int j = (0), j_end_ = (cs.size()); j < j_end_; j++)
      if (cs[i] != cs[j]) {
        if (T10[i][0] > T10[j][0] and T10[i][2] < T10[j][2]) {
          if (par[i] == -1)
            par[i] = j;
          else if (T10[par[i]][0] < T10[j][0])
            par[i] = j;
        }
      }
    if (par[i] >= 0) chi[par[i]].insert(i);
  }
  {};
  {};
  {};
  {};
  vector<int> removed(cs.size());
  vector<vector<int>> ret;
  while (ret.size() < N * 2) {
    for (int d = (2) - 1, d_begin_ = (0); d >= d_begin_; d--) {
      int u = -1;
      for (int i = (0), i_end_ = (removed.size()); i < i_end_; i++)
        if (!removed[i] and cs[i] == d and chi[i].empty()) {
          if (par[i] >= 0) {
            u = i;
            break;
          } else if (u < 0)
            u = i;
        }
      removed[u] = 1;
      ret.emplace_back(T10[u]);
      int p = par[u];
      if (p >= 0) {
        chi[p].erase(u);
      }
    }
  }
  {};
  for (auto vec : ret) {
    cout << vec[0] << ' ' << vec[1] << ' ' << vec[2] << '\n';
  }
}