Temple of Dune

Time limit1sMemory limit128 MB

Problem

The Archaeologists of the Current Millennium (ACM) now and then discover ancient artifacts located at the vertices of regular polygons. Uncovering each artifact requires moving the single sand dune that covers it. One day the archaeologists uncover three artifacts sitting at three distinct vertices of a regular polygon.

Given these three points as distinct vertices of some regular polygon, determine the fewest number of vertices such a polygon could have. In other words, output the smallest number of vertices among all regular polygons that have the three given points as vertices.

Input

The first line contains a positive integer, the number of test cases. Each test case is a single line of six real numbers giving the x and y coordinates of three distinct vertices of a regular polygon, in the order x1 y1 x2 y2 x3 y3.

Output

For each test case, output on its own line a single integer: the fewest number of vertices a regular polygon having the three given points as vertices could have.

You may assume that every test case gives three distinct vertices of a regular polygon with at most 200 vertices.