#include <stdio.h>
#include <stdlib.h>
/*
void stampaj_niz(int a[], int n){
    for (int i = 0; i<n; i++){
        printf("%d ", a[i]);
    }
}
*/
int main()
{
    int n, q;
    //printf("Upisi n: ");
    scanf("%d", &n);
    int Glavni_niz[n];
    for (int i = 0; i<n; i++){
        scanf("%d", &Glavni_niz[i]);
    }
    scanf("%d", &q);
    int r[q];
    int l[q];
    int resenje[q];
    for (int i = 0; i<q; i++){
        scanf("%d", &l[i]);
        scanf("%d", &r[i]);
        if (l[i]==r[i])
            resenje[i] = 1;
        else{
            int temp = 0;
            for (int k = 0; k<r[i]-l[i]; k++){
                if (Glavni_niz[l[i]+k]<Glavni_niz[l[i]-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++;
                }
            }
            //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]==1)
            printf("DA\n");
        else
            printf("NE\n");

    return 0;
}