#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  cin >> n;
  int a[n];
  REP(i, n) cin >> a[i];
  int q;
  cin >> q;
  while (q--) {
    int c, b, e;
    cin >> c >> b >> e;
    if (c == 0) {
      int mn = 1e9 + 1;
      for (int i = b; i < e; ++i) {
        mn = min(mn, a[i]);
      }
      cout << mn << endl;
    } else {
      int mx = -1 * (1e9 + 1);
      for (int i = b; i < e; ++i) {
        mx = max(mx, a[i]);
      }
      cout << mx << endl;
    }
  }
  return 0;
}
