The garden is a square grid with 106 rows and 106 columns. It holds N flowers, and flower i sits in row ri, column ci.
You place sprinklers in the garden. A sprinkler goes on any empty cell, meaning a cell with no flower, and from that cell it shoots four streams of water along the grid: up, right, down, and left.
Flowers have a special property. A flower that receives water from any direction shoots water from its own cell in the same four directions: up, right, down, and left. Vertical streams and horizontal streams run at different heights, so they pass through each other instead of colliding. A stream runs to the edge of the grid, and neither a flower nor another stream blocks it.
Find the smallest number of sprinklers that waters all N flowers.
The first line holds the number of test cases T (1≤T≤20). Each test case has this form.
For each test case, print on its own line the smallest number of sprinklers that waters every flower.
The two pictures below show placements that use the smallest number of sprinklers.

The first example test case

The second example test case