dummy-9
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

Most of the events were over and the participants were roaming about in the Nirma Campus when they reached the Nirma Lake. It is a Large lake and to get to the other side of the lake, you have to go around it. So, participants decide to construct plans for bridges on the lake. They identify points on each side of the lake on which Bridge end points can be made. The students then decide that a bridge can only be built between corresponding end points, i.e. a bridge starting from the ith end point on one side can only end on the ith end point on the other side, where the position of end points is seen in the order in which the points were identified. They just wants to make as many non-cutting bridges as possible, with the constraint in mind. Bridges "cut" if and only if they have exactly one common point that is not an end point.

Input:

The first line of the input contains test cases t. It is followed by 3*t lines, 3 for each test case. The first line of input for each test case contains the number of end points identified on each side, n. The second line contains x-coordinates of end points identified on the first side and similarly the third line contains the x-coordinates of corresponding end points identified on the other side. The end points are givenin the order in which they were identified.

Output:

You are required to output a single line for each test case. The line contains a single integer – the maximum number of bridges possible with the constraints explained above.

Constraints:

1 ≤ t ≤ 50

1 ≤ n ≤ 1000

-1000 ≤ x-coordinates ≤ 1000

SAMPLE INPUT
3
4
2 5 8 10
6 4 1 2
3
5 3 10
6 4 1
6
1 2 3 4 5 6
3 4 5 6 1 2

SAMPLE OUTPUT
2
2
4