The first line will contain an integer
$T$, the number of test cases. Then, the first line of each test case will contain an integer
$N$, the size of the array
$A$ and the next line will contain the array. After that, there will be an integer
$Q$, the number of queries followed by
$Q$ queries as explained above.
This is a companion discussion topic for the original entry at https://toph.co/p/back-to-back