#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  ll arr[1005];
  int n,tc,q,l,r;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>arr[i];
  }
  cin>>tc;
  while(tc--)
  {
    cin>>q;
    if(q==0)
    {
      cin>>l>>r;
      cout<<*min_element(arr+l,arr+r)<<endl;
    }
    else
    {
      cin>>l>>r;
      cout<<*max_element(arr+l,arr+r)<<endl;
    }
  }
}

