Mitre, by mistake, has learned one more lesson in mathematics than he should have, so now he is bored in class while the teacher is explaining that lesson to all other students.

To pass time, Mitre is playing with a table consisting of 3 rows and N columns. The first row of the table has each of the numbers 1 to N written in arbitrary order. The other two rows also contain integers with value between 1 and N, but some values don't appear at all and some appear more than once.

Mitre can now delete as many columns from the table as he desires. After doing so, he will sort the remaining numbers in each row in increasing order. What is the smallest number of columns Mitre must delete, in order for all three rows to be identical after sorting?


The first line of input contains one positive integer T (1 <= T <= 10), the number of test cases.

Each test case starts with a line that contains exactly one integer N (1 <= N <= 40 000), the number of columns.

The second, third and fourth line of each test case contain N integers each, separated by single spaces. All numbers will be between 1 and N. There will be no duplicates in the first row of the table.


For each test case, on a separate line, output the smallest number of columns Mitre must delete.


Time limit: 3 seconds
Memory limit: 64 megabytes


3 2 1 4
2 3 4 4
3 2 2 4
4 1 5 7 6 3 2
7 5 3 2 6 1 4
5 3 5 7 4 1 1

For the first example: if Mitre deletes the third column, the table will look as follows:
     first row: 3 2 4
     second row: 2 3 4
     third row: 3 2 4

After sorting, all rows will be identical and contain the numbers 2, 3 and 4.

For the second example: Mitre needs to delete the first, fourth, fifth and seventh column. After deletion and sorting, all three rows will contain the numbers 1, 3 and 5.

 Submit your code