#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for (int i=0;i<n;i++){
cin>>arr[i];
}
int m;
cin>>m;
for (int i=0;i<m;i++){
int x,y,z;
cin>>x>>y>>z;
int c[n];
for (int j=0;j<n;j++){
c[j]=arr[j];
}
sort(c+x,c+y);
for (int j=0;j<n;j++){
if (arr[j]==c[x-1+z-1]){
cout<<j+1<<endl;
break;
}
}
}
return 0;
}