You are playing a new card game in a casino with the following rules:
Note that the game always lasts exactly $$$n$$$ rounds.
You have tracked the shuffling of the cards and know the order of the cards in the dealer's hand (from top to bottom). You want to maximize your score, so you can swap any two cards in your hand no more than once (to avoid raising suspicion).
Determine the maximum number of points you can achieve.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 5 \cdot 10^4$$$). The description of the test cases follows.
The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^{5}$$$) — the number of cards in the player's hand.
The second line of each test case contains $$$n$$$ integers $$$a_{1}, a_{2}, \ldots, a_{n}$$$ ($$$1 \leq a_{i} \leq 2n$$$) — the values of the cards in the player's hand from top to bottom.
The third line of each test case contains $$$n$$$ integers $$$b_{1}, b_{2}, \ldots, b_{n}$$$ ($$$1 \leq b_{i} \leq 2n$$$) — the values of the cards in the dealer's hand from top to bottom.
It is guaranteed that the values of all cards are distinct.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.
For each test case, output a single integer — the maximum number of points you can achieve.
3713 7 4 9 12 10 26 1 14 3 8 5 1131 6 52 3 458 6 3 10 17 9 5 2 4
6 2 3
In the first test case, the cards can remain unchanged. The gameplay will be organized as follows:
In the second test case, the cards with values $$$1$$$ and $$$5$$$ can be swapped, then the player's hand looks as follows $$$[5, 6, 1]$$$. The gameplay will be organized as follows:
In the third test case, the cards with values $$$3$$$ and $$$10$$$ can be swapped, then the player's hand looks as follows $$$[8, 6, 10, 3, 1]$$$. The gameplay will be organized as follows: