#include <bits/stdc++.h>
using namespace std;

bool idegas(vector<int>& arr, int l, int r) {
    if(l==r)return true;
    int mid = (l + r) / 2;
    int ls = l;
    int fd = r;
    while (l <= r) {
        mid = (l + r) / 2;
        if (mid > ls && arr[mid] < arr[mid-1]) {
            fd = mid;
            break;
        }
        if (arr[mid] > arr[ls]) {
            ls = mid;
            l = mid + 1;
        } else {
            r = mid - 1;
        }
    }
    l = ls;
    r = fd;
    while (l <= r) {
        mid = (l + r) / 2;
        if (mid < fd && arr[mid] > arr[mid+1]) {
            if (mid == ls || mid+1 == fd) {
                return true;
            } else {
                return false;
            }
        }
        if (arr[mid] < arr[fd]) {
            fd = mid;
            r = mid - 1;
        } else {
            l = mid + 1;
        }
    }
    return false;
}

int main() {
   int n;
   cin>>n;
   vector<int> arr(n);
   for(int i=1; i <= n;i++)cin>>arr[i];
   int q;
   cin>>q;
   while(q--){
    int l,r;
    cin>>l>>r;

    if(idegas(arr,l,r))cout<<"DA\n";
    else cout<<"NE\n";
   }
}