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

string solve(int arr[],int li,int ri)
{
    bool res=false;

    int lss=0;
    int mor=0;

    int prev=arr[li];

    for(int it=li+1;it<=ri;it++)
    {
        if(prev>arr[it]) mor++;
        if(prev<arr[it]) lss++;

        prev=arr[it];

        //cout<<"prev "<<prev<<"it "<<arr[it]<<endl;

        //cout<<"less "<<lss<<"more "<<mor<<endl;
        if(lss>1 && mor>1) return "NE";
    }
    return "DA";
}

main()
{
   int N,Q;
   int li,ri;
   vector<string> res;
   int arr[4000];

   //IO
   cin>>N;
   for(int i=0;i<N;i++)
   {
        cin>>arr[i];
   }

   cin>>Q;
   for(int i=0;i<Q;i++)
   {
       cin>>li>>ri;
       li--;
       ri--;
       //solve
       res.push_back(solve(arr,li,ri));

   }

   //out

   for(int i=0;i<res.size();i++)
   {
       cout<<res[i]<<endl;
   }


}