#include <iostream>

using namespace std;

bool poklon(int a[],int n,int l,int r){

  int br=0;

  if(a[l]>=a[l+1] || a[r]<=a[r-1] )
   br++;

   l++,r--;

  while(l<r){


    if(a[l]<=a[l+1])
     l++;
     else
      br++;

     if(a[r]<=a[r+1])
      r--;
     else
        br++;

      cout<<br<<endl;
     if(br>1)
        return false;


  }


 return br<=1;
}
int main()
{
    //1 7 2 7 2 2 3


    int n;
    cin>>n;
    int a[n];
    for(int i=1;i<=n;i++)cin>>a[i];
    int q; cin>>q;
    while(q--){
        int l,r;
        cin>>l>>r;
        if(poklon(a,n,l,r))
        cout<<"DA"<<endl;
        else
         cout<<"NE"<<endl;
    }

    return 0;
}