Containment

No attempts yetTime limit20sMemory limit256 MB

Problem

Cells of atomic energy sit in a three dimensional grid aboard the starship PacificNorthwestPassage, and several of them report failures. To avoid a meltdown the ship's engineer builds enclosures that contain every failing cell.

A panel fits only between two cells, so every panel is axis aligned and separates exactly two cells. One panel takes one minute to set up. The empty space around the grid counts as cells as well, so a panel also goes between a border cell and the space outside it.

Containment means the panels form a closed polytope. In other words you pick a set SS of cells, and every face that lies between a cell in SS and a cell outside SS needs one panel. SS must contain every failing cell, and healthy cells may be enclosed along with them. SS does not have to be connected and it does not have to be convex.

Given the coordinates of the failing cells, report the smallest number of minutes needed to finish the job.

Input

The first line contains the number of test cases NN (1N1001 \le N \le 100). Each test case starts with a line holding the number of failing cells FF (1F1001 \le F \le 100). Each of the next FF lines holds three integers xix_i, yiy_i, ziz_i (0xi,yi,zi90 \le x_i, y_i, z_i \le 9), the position of a failing cell. Within one test case the triples (xi,yi,zi)(x_i, y_i, z_i) are distinct.

Output

For each test case print on one line the minimum number of minutes required to fully contain the problem.