#include <iostream>
#include <stdio.h>
#include <algorithm>
#define MAX 1001

using namespace std;

int main()
{
    int n;
    scanf("%d", &n);
    int arr[MAX];
    for (int i = 0; i < n; i++)
    {
        scanf("%d", arr + i);
    }

    int q, comment, b, e;
    scanf("%d", &q);
    for (int i = 0; i < q; i++)
    {
        scanf("%d", &comment);
        if (comment == 1)
        {
            scanf("%d %d", &b, &e);
            int maxNum = arr[b];
            for (int loop= b + 1; loop < e; loop++)
            {
                maxNum = max(maxNum, arr[loop]);
            }
            printf("%d\n", maxNum);
        }
        else
        {
            scanf("%d %d", &b, &e);
            int minNum = arr[b];
            for (int loop = b + 1; loop < e; loop++)
            {
                minNum = minNum < arr[loop] ? minNum : arr[loop];
            }
            printf("%d\n", minNum);
        }
    }


    return 0;
}

