#include<iostream>
using namespace std;
bool pomocna(int a[], int n, int l, int d){
    int st=0;
    for(int i=l+1;i<=d;i++){
        if(a[i] < a[i-1] && st == 1) return false;
        else if(a[i] < a[i-1] && st == 0) st++;
    }
    return true;
}
int main(){
    int n;
    int *a;
    a = new int[n];
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    int q;
    cin >> q;
    int *l, *r;
    l = new int[q];
    r = new int[q];
    for(int i = 0; i < q; i++){
        cin >> l[i];
        l[i]--;
        cin >> r[i];
        r[i]--;
    }
    for(int i = 0; i < q; i++){
        if(pomocna(a,n,l[i],r[i])) cout << "DA" << endl;
        else cout << "NE" << endl;
    }
    delete a;
    delete l;
    delete r;
}