Fields and Farmers

Time limit1sMemory limit128 MB

Problem

Farming is hard work, and buying land is only the beginning. The whole farming territory is a huge rectangular grid of unit square fields. A farmer first buys an initial set of fields; his parcel consists at the start of exactly those fields. The final parcel is then determined with poles and string by repeating the following steps.

  1. Stick a pole into the center of every field that currently belongs to the parcel.
  2. Wrap a string around the poles, forming the smallest region that encloses all of them (their convex hull).
  3. The new parcel is the set of all fields whose area has a non-empty intersection with this region. A field that shares only an edge or a single corner with the region does not count.

The parcel can only grow, so the steps are repeated until the parcel no longer changes; such a parcel is called final.

It turns out that the farmer can sometimes reach the very same final parcel even if he had bought only a subset of the initial fields. A subset of the initial fields is called valid if starting the process from that subset yields exactly the same final parcel as starting from the complete initial set. The farmer wants to know how many valid subsets of the initial fields there are.

The input contains several independent test cases; solve each of them.

Input

The first line contains a positive integer $Z \le 50$, the number of test cases. Each test case has the following format.

The first line of a test case contains a positive integer $n \le 10^6$, the number of initial fields of the parcel. Each of the next $n$ lines contains two integers $x_i$ and $y_i$ ($-10^9 \le x_i, y_i \le 10^9$), the coordinates of one initial field. All initial fields within a test case are distinct.

Output

For each test case, let $k$ be the number of valid subsets of its initial fields. Output a single line containing $k \bmod (10^9 + 7)$.