#P1602. Basketball

Basketball

Description

Basketball is a well known sport that everybody loves it, so does ssw. One day, ssw assembled 2n players. They are told to line up as two teams to practice passing the basketball. For each team, there are n players. They are required to pass the ball to the players of the other team. Because of their different physical ability, they can only pass the ball to the players in a certain range(that depends on themselves). ssw wants to know, with the best strategy, what is the minimum number of the pass that is needed to be made to let the ball passes from the left of two teams to the right(which team to begin with and which team to end with are not important).** **As ssw is a member of NCUST ACM Association, he decided to write a program to solve that.

Input Format

There are T testcases.

The first line contains a positive integer T(1T10)T(1\leq T \leq 10), denoting the amount of testcases.

For each testcase:

The first line of the input contains a positive integer n(1n104)n(1\leq n\leq10^4), denoting the amount of the basketball players in one team.

The second line of the input contains nn positive integer ai(1n108)a_i(1\leq n\leq10^8) denoting the range that player aia_i ,could pass through.

The third line of the input contains nn positive integer bi(1n108)b_i(1\leq n\leq10^8), denoting the range that player bib_i could pass through.

It is guarateed that the sum of n will not exceed 10510^5

Output Format

For each testcase:

You should print the mininum number of the pass in a single line.

1
10
1 2 3 1 1 1 1 1 1 1
2 2 1 1 1 1 1 1 1 1​
6