import java.util.Scanner;
public class _1区间K大数查询 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n= scanner.nextInt();
int[] shuzu = new int[n];
for (int i = 0; i < shuzu.length; i++) {
shuzu[i] = scanner.nextInt();
}
int m = scanner.nextInt();
int output[] = new int[m];
for (int i = 0; i < m; i++) {
int l = scanner.nextInt();
int r = scanner.nextInt();
int k = scanner.nextInt();
int[] K = new int[r - l + 1];
//将shuzu[j]l和r这部分赋给k
for (int j = l - 1; j < r; j++) {
K[j + 1 - l] = shuzu[j];
}
//将这部分排序,从大到小排序了
for (int j = 0; j < K.length-1; j++) {
for (int j2 = 0; j2 < K.length-1-j; j2++) {
if(K[j2]<K[j2+1]){
int temp = K[j2];
K[j2]= K[j2+1];
K[j2+1] = temp;
}
}
}
output[i] = K[k-1];
}
for (int i = 0; i < m; i++) {
System.out.println(output[i]);
} }
}