#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[n+1];
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    int q;
    int l[q+1], r[q+1];
    cin >> q;
    for(int i = 1; i <= q; i++){
        cin >> l[i];
        cin >> r[i];
    }
    for(int i = 1; i <= q; i++){
        if(pomocna(a,n,l[i],r[i])) cout << "DA" << endl;
        else cout << "NE" << endl;
    }
}