#include<bits/stdc++.h>

using namespace std;

int main(){
    int n;cin >> n;
    vector<int> a(n);
    for(int i = 1;i <= n;i++)
        cin >> a[i];
    int q;cin >> q;
    vector<int> l(q);vector<int> r(q);
    for(int i = 0;i < q;i++)
        cin >> l[i] >> r[i];
    for(int i = 0;i < q;i++){
        vector<int> x;
        for(int j = l[i];j <= r[i];j++){
            x.push_back(a[j]);
        }
        if(is_sorted(x.begin(), x.end())){
            cout << "DA" << endl;
        }
        else{
            int t = 0;
            for(int j = 0;j < x.size();j++){
                if(x[j] < x[j-1]){
                    t++;
                }
            }
            if(t > 2){
                cout << "NE" << endl;
            }
            else{
                cout << "DA" << endl;
            }
        }
    }
    return 0;
}