#include <iostream>

using namespace std;

struct dvabroja{
    unsigned long long int l, r;
};


int main(void){
    unsigned long long int n;
    cin >> n;

    unsigned long long int a[n];

    for(int i=0; i<n; ++i){
        cin >> a[i];
    }

    unsigned long long int q;
    cin >> q;

    dvabroja niz[q];

    for(int i=0; i<q; ++i){
        cin >> niz[i].l >> niz[i].r;
    }


    unsigned int brojac;

    for(int i=0; i<q; ++i){
        brojac = 0;
        for(int j=(niz[i].l-1); j<(niz[i].r-2); ++j){
            if(niz[i].l == niz[i].r)
                break;
            if(a[j+1] < a[j]){
                brojac += 1;
            }

            if(brojac > 1){
                cout << "NE" << endl; break;
            }
        }

        if(brojac == 1 && a[0] > a[1])
            cout << "NE" << endl;
        else if (brojac <= 1)
            cout << "DA" << endl;

    }


    return 0;
}