Axes of Symmetry

No attempts yetTime limit1sMemory limit128 MB

Problem

Little Johnny, a gifted young mathematician, has a younger sister named Justina. Johnny is happy to help her with homework, but he tires of checking the same problems over and over. One day the math teacher assigned many exercises about finding the axes of symmetry of various figures, and Justina wants to double-check her answers many times. Since Johnny would rather leave for a trip to the seaside, he asks you to write a program that checks Justina's answers for him.

Write a program that:

  • reads the descriptions of several polygons from standard input,
  • determines the number of axes of symmetry of each polygon,
  • writes the results to standard output.

An axis of symmetry is a line such that folding the figure along it makes the figure coincide exactly with itself.

Input

The first line contains the number of polygons tt (1t101 \le t \le 10). Then tt polygon descriptions follow.

The first line of each description contains the number of vertices nn (3n1053 \le n \le 10^5). Each of the next nn lines contains two integers xx and yy (108x,y108-10^8 \le x, y \le 10^8), the coordinates of the vertices given in order along the polygon.

The polygons need not be convex, but they have no self-intersections: any two sides share at most one point (their common endpoint, if they actually touch). Moreover, no two consecutive sides are parallel.

Output

Output exactly tt lines. The kk-th line contains a single integer nkn_k, the number of axes of symmetry of the kk-th polygon.

Hint

In Poland, public and national holidays cluster at the beginning of May: May 1 (Labour Day), May 2 (Flag Day), and May 3 (Constitution Day). The middle day is not an official holiday, but people customarily take it off as well. If May 1 falls on a Monday or May 3 on a Friday, you get a long May weekend.