Diamonds#8174

Diamonds

1 second
128 megabytes
Easy

A diamond's overall worth is determined by its mass in carats as well as its overall clarity. A large diamond with many imperfections is not worth as much as a smaller, flawless diamond. The overall clarity of a diamond can be described on a scale from - adopted by the American Gem Society, where represents a flawless diamond and represents an imperfect diamond.

Given a sequence of diamonds, each with weight, w_i, in carats and clarity c_i, on the scale described above, find the longest subsequence of diamonds for which the weight and clarity are both becoming strictly more favorable to a buyer.

prb8274.gif

In the following sequence of diamonds

prb8274_1.gif

the longest desirable subsequence is

because the weights strictly increase while the clarities strictly decrease.

Input

Starts with a line with a number of test cases (1 \le t \le 100). Each test case begins with a line with a single integer (1 \le n \le 200), indicating the number of diamonds. Next follow lines with real numbers w_i and c_i, (0.0 \le w_i, c_i \le 10.0), indicating the weight in carats and the clarity of diamond respectively.

Output

For each test case, print a single line with the length of the longest desirable subsequence of diamonds.

Examples

Example 1

Loading
Loading