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


int findLengthOfShortestSubarray(int arr[], int N)
{


    int minlength = INT_MAX;

    int left = 0;
    int right = N - 1;


    while (left < right &&
       arr[left + 1] >= arr[left])
    {
        left++;
    }

    if (left == N - 1)
        return 0;


    while (right > left &&
       arr[right - 1] <= arr[right])
    {
        right--;
    }


    minlength = min(N - left - 1, right);


    int j = right;
    for(int i = 0; i < left + 1; i++)
    {
        if (arr[i] <= arr[j])
        {


            minlength = min(minlength, j - i - 1);
        }
        else if (j < N - 1)
        {
            j++;
        }
        else
        {
            break;
        }
    }


    return minlength;
}


int main()
{

    int n, a[10],b[10] ,q, l[10],r[10];
    cin>>n;
    for (int i = 1; i <= n; i++){
        cin>>a[i];
    }
    cin>>q;
    for (int i = 1; i <= q; i++){
        cin>>l[i]>>r[i];
    }

    int ll,rr,nn;
    for (int i = 1; i <= q; i++){
        ll=l[i];
        rr=r[i];
        nn=rr-ll+1;
        for (int i = 0; i < nn; i++){
            b[i]=a[ll+i];
        }
        /*for (int i = 0; i < nn; i++){
            cout<<b[i]<<" ";
        }
        cout<<nn<<" "<<ll<<" "<<rr<<" ";*/
        if(findLengthOfShortestSubarray(b, nn)==1 or findLengthOfShortestSubarray(b, nn)==0)cout<<"DA"<<" ";
        else cout <<"NE";
        cout<<endl;
    }
}