Chiaki has n beautiful gems. The color of the i-th gem is c_i and the value is v_i.
Chiaki would like to choose at least 3 gems and make a necklace such that the adjacent gems must have different color. Formally, let the indices of gems used in the necklace be a_1,a_2,…,a_m (m≥3) in clockwise order. For each i (1≤i≤m), c_a_i should be different from c_a_imodm+1.
Chiaki would like to find a necklace with the maximum possible sum of values: that is, to maximize ∑_i=1mv_a_i.
There are multiple test cases. The first line of input contains an integer T, indicating the number of test cases. For each test case:
The first line contains an integer n (1≤n≤2⋅105): the number of gems.
The second line contains n integers c_1,c_2,…,c_n (1≤c_i≤n) denoting the color of each gem.
The third line contains n integers v_1,v_2,…,v_n (−109≤v_i≤109) denoting the value of each gem.
It is guaranteed that the sum of n in all test cases does not exceed 2⋅105.
For each test case, the first line contains an integer m (m≥3): the number of gems in the necklace (note that you don't need to maximize it). The second line contains m integers a_1,a_2,…,a_m (1≤a_i≤n): the indices of gems used in the necklace in clockwise order. If there are several possible answers, print any one of them.
If Chiaki could not find such a necklace, just output an integer −1 on a single line.