#include <iostream>
#include <algorithm>
#include <cassert>


using namespace std;


int min(int b,int e,int array[],int n){
    
    assert(b<=n);
    assert(e<=n);
    
    int minp;
    minp=array[b];
    
    for(int i=b;i!=e;++i){
        minp=(minp<=array[i])?minp:array[i];
    }
    
    return minp;
}

int max(int b,int e,int array[],int n){
    int maxp;
    maxp=array[b];
    
    for(int i=b;i!=e;++i){
        maxp=(maxp>=array[i])?maxp:array[i];
    }
    
    return maxp;
}


int main(){
    int n;
    cin>>n;
    
    int array[n];
    
    for(int i=0;i!=n;++i){
        cin>>array[i];
    }
    
    int q;
    cin>>q;
    
    for(int i=0;i!=q;++i){
        int com,b,e;
        cin>>com>>b>>e;
        
        switch (com) {
            case 0:
                cout<<min(b,e,array,n)<<endl;
                break;
            case 1:
                cout<<max(b,e,array,n)<<endl;
                break;
        }
    }
}

