#include <bits/stdc++.h>
using namespace std;
long long N,A[20005],B[20005],Q,l[10005],r[10005];
string rez[20004];
void napraviB(int L, int R){
    memset(B, 0, sizeof(B));
    B[R+1]=2000000000;
    for(int i = L;i<=R;i++){
        B[i]=A[i];
    }
}
bool sortable(int L, int R){
    int br=0;
    for(int i = L;i<=R;i++){
        if(B[i+1]<B[i]){
            br++;
        }
    }
    if (br<=1 ){
        return true;
    }
    else {
        return false;
        }
}
int main(){
    scanf("%d", &N);
    for(int i = 1;i<=N;i++){
        scanf("%d", &A[i]);
    }
        scanf("%d", &Q);
    for(int i = 1;i<=Q;i++){
        rez[i]="NE";
        scanf("%d%d", &l[i], &r[i]);
        if(abs(l[i]-r[i])<=1){
            rez[i]="DA";
        }
        napraviB(l[i],r[i]);
        if(sortable(l[i],r[i])){
            rez[i]="DA";
        }
        cout<<rez[i]<<endl;
    }
    return 0;
}