#include <iostream>

//vector<bool> prost(n+1,true);
//std::memset(prost1,0,sizeof(prost1));

const int MAX_N=200069;

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    int n;
    std::cin>>n;
    int A[MAX_N];
    for (int i=1;i<n+1;i++){
        std::cin>>A[i];
    }
    int q,li,ri;std::cin>>q;
    int countt=0;
    bool resenja[q];
    for (int i=1;i<=q;i++){
        std::cin>>li>>ri;
        for(int j=li;j<ri;j++){
            if(A[j]>A[j+1]){countt++;}
        }
        if (countt>1){resenja[i]=true;}
        countt=0;
    }
    for (int i=1;i<=q;++i){
        if(resenja[i]==true) {std::cout<<"NE\n";}
        else{std::cout<<"DA\n";}
    }
    return 0;
}