#include <iostream>

using namespace std;

int main()
{
    int n, a[3000], q, niz[3000], br=0, l, r;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    cin >> q;
    for(int i=0; i<q; i++){
        cin >> l >> r;
        br=0;
        for(int j=l-1; j<r-1; j++){
            if(a[j]>a[j+1])
                br++;
        }
        if(br>1)
            niz[i]=0;
        else
            niz[i]=1;
    }
    for(int i=0; i<q; i++){
        if(niz[i]==1)
            cout << "DA" << endl;
        else
            cout << "NE" << endl;
    }
    return 0;
}