#include <bits/stdc++.h>
using namespace std;
int a[1000005];
bool r[1000005];
int q,n;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    cin>>q;
    int x,y;
    while(q--){
        cin>>x>>y;
        int br1=0;
        for(int i=x;i<=y;i++){
            if(a[i]<a[i-1] and i!=x)br1++;
            else if(a[i]>a[i-1] and a[i]<a[i-2])br1++;
            if(br1>=2){
            cout<<"NE"<<endl;
            break;}
            }

        if(br1<2) cout<<"DA"<<endl;
        }

    return 0;
}