QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 32 MB Total points: 10

#10385. Declining Sequences [B]

الإحصائيات

Consider an integer sequence $ a_{1}, a_{2}, \ldots, a_{n} $. A (strictly) increasing sequence of indices $ c_{1}, c_{2}, \ldots, c_{p} $, where $1 ≤ c_{i} ≤ n $, is called declining if $ a_{c_{1}} > a_{c_{2}} > \ldots > a_{c_{p}}$.

A sequence of indices $ c_{1}, c_{2}, \ldots, c_{p} $ is lexicographically smaller od than a sequence of indices $ d_{1}, d_{2}, \ldots, d_{p} $ if for some $ k \in [1,p]$ it holds that $ c_{i} = d_{i} $ for each $ i \in [1,k-1] $ and $ c_{k} < d_{k} $.

Your task is to answer several queries of the form: find the (lexicographically) $ k $-th smallest declining sequence of indices.

Input Format

The first line of the standard input contains three integers $ n $, $ p $ and $ q $ ($1 ≤ n, q ≤ 100 000$, $1 ≤ p ≤ 10$) that denote the length of the sequence ($ a_{i} $), the length of the considered declining sequences and the number of queries. The second line contains $ n $ integers $ a_{i} $ ($-10^{9} ≤ a_{i} ≤ 10^{9} $). The following $ q $ lines contain descriptions of the queries: the $ j $-th of these lines contains a single integer $ k_{j} $ ($1 ≤ k_{j} ≤ 10^{18}$).

Output Format

Your program should write $ q $ lines to the standard output. The $ j $-th line should contain the $ k_{j} $-th smallest declining sequence of indices or a single number -1 if the requested declining sequence does not exist.

Example

Input

5 3 3
-1 6 5 2 1
1
5
3

Output

2 3 4 
-1
2 4 5

Notes

The declining sequences of indices of length 3 in this example are, in the lexicographical order, as follows: (2, 3, 4), (2, 3, 5), (2, 4, 5) and (3, 4, 5).