#include <bits/stdc++.h>
using namespace std;
int N,Q;
int main(){
cin>>N;
int A[N];
for(int i=1;i<=N;i++){
    cin>>A[i];
}
cin>>Q;
while(Q--){
    int L,R;
    int br=0;
    int greska=0;
    int promena=1;
    cin>>L>>R;
    for(int i=L;i<R;i++){
        if(A[i]<=A[i+1])
        br+=1;
        else if(A[i]>A[i+1] and greska<2)
        greska+=1;
        else break;

    }
    if(br==R-L or br==R-L-1)
        cout<<"DA"<<endl;
    else cout<<"NE"<<endl;
}
return 0;
}