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.
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.
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.
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)$.