#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int a[1010];
int main() {
	int n, q;
	cin >> n;
	rep(i, n)cin >> a[i];
	cin >> q;
	while (q--) {
		int Q, x, y;
		cin >> Q >> x >> y;
		if (Q == 0) {
			int ans = 1145141919;
			for (int i = x; i < y; i++)ans = min(ans, a[i]);
			cout << ans << endl;
		}
		else {
			int ans = -1145141919;
			for (int i = x; i < y; i++)ans = max(ans, a[i]);
			cout << ans << endl;
		}
	}
	return 0;
}
