#include <iostream>
using namespace std;

string provera(int a[], int l, int r){
    bool provera = true, test = true;
    if(l == r){
        return "DA\n";
    }
    else{
        for(int i = l-1;i < r-1;i++){
            if(a[i] > a[i+1]){
                if(provera){
                    provera = false;
                }
                else{
                    test = false;
                    break;
                }
            }
        }
        if(test){
            return "DA\n";
        }
        else{
            return "NE\n";
        }
    }
}


int main()
{
    long long int n, q;
    cin >> n;
    int a[n];
    string answer = "";
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    cin >> q;
    int l[q], r[q];
    for(int i = 0;i < q;i++){
        cin >> l[i] >> r[i];
        answer+=provera(a,l[i],r[i]);
    }
    cout << answer;
    return 0;
}