Interesting Matrix Problem
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述


Due to the outbreak, CYY has to be a NEET at home and learn online classes. Today, at 8 o'clock, the data structure class will begin, but his homework hasn't been finished.

His homework is described like this:

Given large matrix of , and the element of the matrix at is equal to . There are queries, each of them will give you a number , and you should answer what the k-th smallest number in the matrix is. For example, the 5th smallest number in is , and the same integers should contribute as many as the number of them occupying in the matrix.

Since it's early in the morning, CYY still hasn't got full conscious yet and fails to finish this easy task. Can you help CYY to finish his homework and get 4.0 GPA?

输入描述:

The first line contains three integers: .

Then each of the following  lines contains a integer .

输出描述:

For each query, output a line contains the k-th smallest number in the matrix.
示例1

输入

复制
3 5 3
2
3
5

输出

复制
2
2
3