#include <bits/stdc++.h>
using namespace std;
bool provera(int &l,int r,vector<int> a){

    while(l!=r){
        if(a[l]>a[l+1])return false;
        l++;
    }
    return true;
    
}

bool funkcija(int l,int r,vector<int> a){
    bool jeste=true;

    int j=l;
    if(is_sorted(a.begin()+l+1, a.end()-(r+1))) return true;
    if(r-l>2){
        while(l<=r-1 ){
            if(a[l]>a[l+1] || jeste==false){
                /*if(a.front()==a[l] &&jeste==true){
                    if(a[l]>a[l+2])return false;
                    jeste=false;
                }else{
                    if(a[l+1]<a[l-1])return false;
                    //if(a[l+2]>=a[l])
                }
                
                if(jeste==false){
                    
                }*/
                if(j==l){
                    
                    if(a[l]>a[l+2])return false;
                    jeste=false;
                }
                jeste=false;
                l=l+2;
                if(provera(l,r,a))return true;
                else return false;
            }
            
            
          /* if(a[l]>a[l+1]){
                if(a.front()==a[l]){
                    int a=a[l];
                    
                    int c=a[l+2];
                    if(a>c)return false;
                    l++;
                }else if(a.front()!=a[l]){
                    int b=a[l+1]
                    int c=a[l+2];
                    if(b<a[l-1])return false
                    if(c<b)return false; 
                }
                
                
            }*/
            
            
            
            l++;
            
        }
    }else if(r-l==2){
        if(is_sorted(a.begin()+l, a.end()-(a.size()-(r+1))))return true;
        
        else {
            if(a[l]==a[l+1] || a[l]==a[l+2] || a[l+1]==a[l+2])return true;
            else{
                if(a[l]==max(max(a[l],a[l+1]),a[l+2]))return false;
            }
        }
    }else if(r-l==1){
        return true;
    }else if (r-l==0){
        return true;
    }
    
    return true;
    
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);  
    int n;
    scanf("%d", &n);

    vector<int> a(n + 1);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }

    int q;
    scanf("%d", &q);

    int q1 = q;
    vector<bool> removed(q);
    while (q > 0) {
        int l, r;
        scanf("%d %d", &l, &r);
        l--;
        r--;
       
        removed[q] = funkcija(l,r,a);

        q--;
    }
    
    
    
    for (int i = q1; i > 0; i--) {
        if (removed[i]) {
            printf("DA\n");
        } else {
            printf("NE\n");
        }
    }

    return 0;
}