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 S of cells, and every face that lies between a cell in S and a cell outside S needs one panel. S must contain every failing cell, and healthy cells may be enclosed along with them. S 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.
The first line contains the number of test cases N (1≤N≤100). Each test case starts with a line holding the number of failing cells F (1≤F≤100). Each of the next F lines holds three integers xi, yi, zi (0≤xi,yi,zi≤9), the position of a failing cell. Within one test case the triples (xi,yi,zi) are distinct.
For each test case print on one line the minimum number of minutes required to fully contain the problem.