Convex hull 3D - 2#1836

Convex hull 3D - 2

1 second
256 megabytes
Easy

Given points in space, where no points lie in the same plane, find the convex hull of these points.

Input

The first line contains the number — the number of test cases. The following lines describe the tests. Each test begins with a line containing (1 \leq n \leq 1000) — the number of points. Next, lines follow, each containing three integers — the coordinates of the points. All coordinates are integers with absolute values not exceeding . The total number of points in all tests does not exceed .

Output

For each test, output the following. In the first line, print the number — the number of faces. Then, in the following lines, describe each face: the number of vertices and the indices of the points in the original set. The points are numbered in the same order as given in the input file. Within a face, the points must be listed in counterclockwise order with respect to the outward normal of the face.

Examples

Example 1

Loading
Loading