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

bool dali(vector<int>&a){
    int n = a.size();
    bool r = false;
    int i=1;
    while(i<=n){
        i++;
        if(a[i]<a[i-1]){
            if(r) return false;
            r = true;
            if(i>1 and a[i] < a[i-2]) a[i] = a[i-1]; 
            
        }
    } 
}
            
int main()
{
    int n; cin >> n;
    vector<int>a(n);
    for(int i =1; i<=n; i++) cin >> a[i];
    int q; cin >> q;
    int l;
    int d;
    for(int i=q; i>0; i--){
        cin >> l >> d;
        vector<int>s(a.begin() + l-1, a.begin() + d);
        cout << dali(a) ? "DA" : "NE";
        
    }
    
    
    return 0;
}


        
        
    

    return 0;
}