#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 1100
#define INF ((int)1e9+9)

int main(){
	int n, a[MAX], q, com, b, e;
	
	cin>>n;
	
	for(int i = 0; i < n; i++) cin>>a[i];
	
	cin>>q;
	
	for(int i = 0; i < q; i++){
		cin>>com>>b>>e;
		int ma = -INF, mi = INF;
		for(int j = b; j < e; j++) ma = max(a[j], ma), mi = min(a[j], mi);
		cout<<(com?ma:mi)<<endl;
	}
	return 0;
}
