#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
const int maxn = 1010;
int solve(int arr[]) {
int l, r, k;
cin >> l >> r >> k;
vector<int> vi(arr+l-1, arr+r); //用int[]初始化vector
sort(vi.begin(), vi.end(), greater<int>()); //降序排列
cout << vi[k-1] << endl;
}
int main() {
int n;
cin >> n;
int arr[maxn];
for(int i = 0; i < n; i++) cin >> arr[i];
int m;
cin >> m;
while (m--) {
solve(arr);
}
return 0;
}