#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n, q;
    scanf("%d", &n);
    int Glavni_niz[n];
    for (int i = 0; i<n; i++){
        scanf("%d", &Glavni_niz[i]);
    }
    scanf("%d", &q);
    int resenje[q];
    for (int i = 0; i<q; i++){
        int r;
        int l;
        scanf("%d", &l);
        scanf("%d", &r);
        if (l==r)
            resenje[i] = 1;
        else{
            int temp = 0;
            for (int k = 0; k<r-l; k++){
                if (Glavni_niz[l+k]<Glavni_niz[l-1+k]){
                    //printf("Broj1: %d  Broj2: %d  k: %d  i: %d  l: %d  r: %d\n", Glavni_niz[l[i]+k], Glavni_niz[l[i]-1+k], k, i, l[i], r[i]);
                    temp++;
                    if (temp>=2)
                        k=r-l;
                }
            }
            //printf("   temp: %d\n", temp);
            if (temp<2)
                resenje[i] = 1;
            else
                resenje[i] = 0;
        }
    }

    for(int i = 0; i<q; i++)
        if(resenje[i])
            printf("DA\n");
        else
            printf("NE\n");

    return 0;
}