#include <bits/stdc++.h>
using namespace std;
int n,a[200005],q,l,r,suma[200005],clan;
void niz(){
    suma[1]=1;
    for (int i=1;i<=n;i++){
        if (a[i]>=a[i-1]) suma[i]=1;
        else suma[i]=0;
    }
}
void prefiks(){
    suma[1]=1;
    for (int i=2;i<=n;i++){
        suma[i]=suma[i-1]+suma[i];
    }
}
int  main(){
    cin>>n;
    for (int i=1;i<=n;i++){
        cin>>a[i];
        if (a[i]==1 or a[i]==2) clan++;
    }
    niz();
    prefiks();
    cin>>q;
    for (int i=1;i<=q;i++){
        cin>>l>>r;
        int uradio=0;
        if (clan==n){
            int jeste=0;
            for (int j=r-1;j>=l;j--){
                if (a[j]>a[j+1]) jeste++;
            }
            if (jeste==1) uradio=1;
        }
        if (uradio==0){
            int br=(suma[r]-suma[l])+1;
            int clan=r-l+1;
            if (clan-br<=1) cout<<"DA"<<endl;
            else cout<<"NE"<<endl;
        }
        else cout<<"NE"<<endl;

    }

    return 0;
}