#include<stdio.h> int devide(long a[], int low, int high) {
long key = a[high];
while (low<high) {
while (low<high&&a[low]>key) {
low++;
}
if (low<high)
a[high--] = a[low];
while (low<high&&a[high]<key) {
high--;
}
if (low<high)
a[low++] = a[high];
}
a[high] = key;
return high;
} void sort(long a[], int low, int high) {
if (low>high) {
return;
}
int j;
j = devide(a, low, high);
sort(a, low, j - );
sort(a, j + , high);
} int main() {
int n, i, j;
long a[], b[];
int m;
int l, r, k;
scanf("%d", &n);
for (i = ; i<n; i++) {
scanf("%ld", &a[i]);
}
scanf("%d", &m);
for (i = ; i<m; i++) {
for (j = ; j<n; j++) {
b[j] = a[j];
}
scanf("%d%d%d", &l, &r, &k);
sort(b, l - , r - );
printf("%d\n", b[l + k - ]);
}
return ; }