Permutation
题号:NC17345
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 128 M,其他语言256 M
Special Judge, 64bit IO Format: %lld

题目描述

Chiaki has a special machine which can generate permutations. You can give any restrictions to the machine, it will generate all the permutation under the restrictions .
Chiaki has generated n restrictions and the i-th of them is that the position of ai should be less than the position of bi and ci.
The restrictions generated by Chiaki are somewhat special and the sequence a1,a2,...,an, b1,b2,...,bn, c1, c2, ..., cn is a permutation of 1,2,...,3n.
Among all the permutations generated by the machine, Chiaki would like to find one with minimum value.
The value of a permutation p1,p2,...,pn is .

输入描述:

There are multiple test cases. The first line of input contains an integer T, indicating the number of test cases. For each test case:
The first line contains an integer n (1 ≤ n ≤ 105) -- the number of restrictions.
Each of the next n lines contains three integers ai, bi and ci (1 ≤ ai, bi, ci ≤ 3n) denoting a restriction.
It is guaranteed that the sum of all n does not exceed 106.

输出描述:

For each test case, output 3n integers denoting the permutation with minimum value. If there are multiple solutions, you can output any of them.
示例1

输入

复制
2
1
1 2 3
2
3 4 2
1 6 5

输出

复制
1 2 3 
3 2 1 4 5 6