Metal

No attempts yetTime limit1sMemory limit128 MB

Problem

You are a metal artist making a piece of steelwork. You first mark nn points on a large steel board, then cut out from the board a polygon that connects those nn points. To perform the cut, you melt the board along the boundary of the polygon with two lasers that hang from a long horizontal bar suspended above the board, as shown in Figure 1. The bar is vertical, that is, parallel to the yy-axis, and it moves continuously (never stopping) only in the positive xx-direction, from the left side of the board toward the right side. Each laser can slide only along the bar, and the two lasers can never meet on the bar. Moreover, the bar advances monotonically from left to right and can never return to a position to the left of where it currently is.

These conditions imply that every polygon you can obtain is both simple and monotone. A polygon PP is simple if no two of its edges intersect, except that two adjacent edges meet only at their shared endpoint, and PP contains no holes. A polygon PP is monotone if its intersection with any vertical line is either empty, a single point, or a single line segment.

Figure 1

Figure 1. A cutting tool with two lasers hanging from a vertical bar.

To choose a good shape for your steelwork, you want to know how many different simple monotone polygons on the nn points exist. Your task is to compute that number. For example, Figure 2 shows an instance of seven points for which there are exactly four different simple monotone polygons.

Figure 2

Figure 2. Four different simple monotone polygons for a set of seven points.

Input

The input is read from standard input. The first line contains the number of test cases TT. Each test case starts with a line containing an integer nn (3n503 \le n \le 50), the number of points in S={s0,s1,,sn1}S = \{s_0, s_1, \ldots, s_{n-1}\}. Each of the next nn lines contains two nonnegative integers xix_i and yiy_i (0xi,yi2000000 \le x_i, y_i \le 200000), meaning that point sis_i has coordinates (xi,yi)(x_i, y_i). No two points of SS have the same xx-coordinate.

Output

For each test case, write to standard output a single line containing the number of different simple monotone polygons that connect the nn points of SS.