#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)

#define BR "\n"
#define SP " "

int main() {
  int N;
  cin >> N;

  vector<int> A(N);
  rep0(i, N) cin >> A[i];

  int Q;
  cin >> Q;
  rep0(i, Q) {
    int c, b, e;
    cin >> c >> b >> e;
    if (c == 0) cout << *min_element(A.begin() + b, A.begin() + e) << BR;
    else cout << *max_element(A.begin() + b, A.begin() + e) << BR;
  }
  return 0;
}
