#include <iostream>

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

using namespace std;

const int MAX_N=200069;
typedef long long ll;

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