queries-1-1

Given an array of N elements and Q queries. Each query containing an integer X. For each query print the X^th smallest number of the input array. 

Note : Don't use any predefined function. Try to make your own code.
Constraints
1 ≤ N ≤ 10^5
1 ≤ Value of element of array ≤ 10^18
1 ≤ Q ≤ 10^6
1 ≤ X ≤ N

Input
First line contains value N. Next line contains N integers separated by a single space. Third line contains value Q. Next line contains Q integers separated by a space.

SAMPLE INPUT
8
5 6 9 7 4 1 5 1
5
8 5 4 1 3

SAMPLE OUTPUT
9
5
5
1
4

Source: hackerearth | Difficulty: EASY


Solutions: