#include <iostream>

using namespace std;

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