Problem D: [Medium I] Skylar's Investment In Stocks

Problem D: [Medium I] Skylar's Investment In Stocks

Time Limit: 1 Sec  Memory Limit: 32 MB
Submit: 967  Solved: 232
[Submit][Status][Web Board]

Description

Skylar is a smart girl who is thirsty for making a big fortune. Recently, she decides to invest in stocks to try her luck. Unfortunately, due to the miserable state of the economy and lack of knowledge and experience, she suffered a great loss of money. She has no choice but to ask LowbieH for help. LowbieH offers her a predictor which can forecast the stock index of the upcoming \(n\) days. Skylar is very excited and can't wait to make money. She wants to know the minimum days that she needs to wait to get a rise in the index if making a buy-in on the \(k_{th}\) day.

Input

The first line is an integer \(T(1\leq T \leq 12)\), meaning the number of the test cases.

For each test case, an integer \(n(1\leq n \leq 2*10^5)\) denotes the number of the forecasted upcoming days, followed by \(n\) stock indexes for each day: \(index_1,\cdots,index_{n}(1\leq index_i \leq 10^9, 1\leq i \leq n)\).

The next line contains an integer \(q(1\leq q \leq 2*10^5)\) denoting the number of the queries. For each query, there's an integer \(k\), which means that Skylar will make a buy-in on the \(k_{th}\) day.

Output

Print the answer of each query in \(q\) lines. If Skylar can't get a rise within the upcoming \(n\) days, print \(-1\).

Sample Input

1
5
2 3 3 5 4
5
1 2 3 4 5

Sample Output

1
2
1
-1
-1

HINT


"rise" should be understanded as "strictly bigger than".



Huge input and output. You are recommended to use fast I/O.

[Submit][Status]