C. Hamza and Fulfillment Syndrome
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

In the Amazon Fulfillment Center, there is a sequence of $$$n$$$ items; each item $$$i$$$ has two values, ID and a color.

As their manager, Hamza noticed that Ahmad and Bahaa were wasting a lot of time playing billiards in the fun area, so he decided to punish them.

He tasked them with finding the maximum size of a good package.

A package of size $$$k$$$ is considered good if it contains $$$k$$$ items with strictly increasing ID numbers and no two adjacent items share the same color.

Note: Items must be arranged in the same order as given in the input.

Can you help them finish the task?

Input

The first line of the input contains an integer $$$t$$$ $$$(1 \leq t \leq 10^3)$$$ – the number of test cases.

The first line of each test case contains an integer $$$n$$$ $$$(1 \leq n \leq 10^5)$$$.

The second line of the test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \leq a_i \leq 10^9)$$$, where $$$a_i$$$ is the ID of the $$$i_{th}$$$ item.

The third line of the test case contains $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ $$$(1 \leq b_i \leq 10^9)$$$, where $$$b_i$$$ is the color of the $$$i_{th}$$$ item.

It's guaranteed that the sum of $$$n$$$ over all test-cases doesn't exceed $$$10^5$$$.

Output

For each test case, print a single integer representing the largest value of $$$k$$$ as described in the statement.

Example
Input
3
4
1 2 3 4
1 2 1 2
4
1 2 3 4
1 2 2 1
5
2 1 3 2 4
1 2 2 1 2
Output
4
3
3