#include <bits/stdc++.h>

using namespace std;

int main()
{
    int N,A[200000],Q,QS[100000],QE[10000],pr;
    scanf("%d",&N);
    for(int i =0;i<N;i++){
        scanf("%d",&A[i]);
    }
    scanf("%d",&Q);
    for(int i = 0;i<Q;i++){
        scanf("%d%d",&QS[i],&QE[i]);
    }

    for(int i = 0;i<Q;i++){
        pr=0;
        for(int j = QS[i];j<QE[i];j++){

            if(A[j-1]>A[j]){
                pr+=1;
            }
        }
        if(pr>=2)printf("NE\n");
        else printf("DA\n");
    }
}