#include <iostream>
using namespace std;

bool ascending(int a[], int n){
    bool test = true, provera = true;
    if(n == 1){
        return true;
    }
    else{
        for(int i = 0;i < n-1;i++){
            if(a[i] > a[i+1]){
                if(provera){
                    provera = false;
                }
                else{
                    test = false;
                    break;
                }
            }
        }
    }
    return test;
}

void provera(int b[], int l, int r){
    int m = r-l+1;
    int a[m];
    int k = 0;
    for(int i = l-1;i < r;i++){
        a[k] = b[i];
        k++;
    }
    if(ascending(a,m)){
        cout << "DA\n";
    }
    else{
        cout << "NE\n";
    }
}

int main()
{
    int n, q;
    cin >> n;
    int a[n];
    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];
    }
    for(int i = 0;i < q;i++){
        provera(a,l[i],r[i]);
    }
    return 0;
}