#include <bits/stdc++.h>
using namespace std;

int n,N[200005];
vector <int> v;
int q,a,b,cnt;
bool bul;

int main(){

    cin >> n;
    cin >> N[1];
    for(int i=2;i<=n;i++){
        cin >> N[i];
    }

    cin >> q;
    for(int i=1;i<=q;i++){
        cnt=0;
        cin >> a >> b;
        for(int j=a+1;j<=b;j++){
            if(N[j-1]>N[j]){
                cnt++;
            }
            if(cnt>=2) break;
        }
        if(cnt>1) cout << "NE\n";
        else cout << "DA\n";
    }


return 0;
}