#include <stdio.h>
#include <stdlib.h>
int provera(int n, int niz[n], int levi, int desni)
{
    levi--;
    desni--;

    if(desni - levi <= 2)
    {
        printf("DA");
        return;
    }
    /*int brr[n], l = 1;

    brr[0] = arr[0];
    for (int i = 1; i < n; i++) {
        if (brr[l - 1] <= arr[i]) {
            brr[l] = arr[i];
            l++;
        }
    }

    // Print the sorted array
    for (int i = 0; i < l; i++)
        cout << brr[i] << " ";


*/
    int br = 0;
    for(int i = levi; levi < desni; levi++)
    {
        if(br == 2)
        {
            printf("NE");
            return;
        }
        if(niz[levi]<niz[desni])
        {
            br++;

        }
    }
    printf("DA");
}

int main()
{
    int n, q, lev, des;
    scanf("%d", &n);
    int niz[n];
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &niz[i]);
    }
    for(int i = 0; i < n; i++)
    {
        printf("%d ", niz[i]);
    }
    scanf("%d", &q);
    for(int i = 0; i < q; i++)
    {
        scanf("%d%d", &lev, &des);
        provera(n, niz, lev, des);
    }

}