#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";
}
*/
vector<int> solve2(int arr[],int N){

    int prev=arr[0];
    vector<int> res;

    for(int it=1;it<=N;it++)
    {
        if(prev>arr[it]) res.push_back(1);
        if(prev<arr[it]) res.push_back(-1);
        else res.push_back(0);
        prev=arr[it];
    }
    return res;
}
string solve3(vector<int> dict,int li,int ri)
{
     int lss=0;
     int mor=0;

    for(int it=li;it<=ri;it++)
    {
        if(!dict[it]) lss++;
        if(dict[it]==1) mor++;
        if(lss>1 && mor>1) return "NE";
    }
    return "DA";
}
main()
{
   int N,Q;
   int li,ri;
   vector<string> res;
   vector<int> dict;

   int arr[4000];


   //IO
   cin>>N;
   for(int i=0;i<N;i++)
   {
        cin>>arr[i];
   }
   dict=solve2(arr,N);
   cin>>Q;
   for(int i=0;i<Q;i++)
   {
       cin>>li>>ri;
       li--;
       ri--;
       //solve
       res.push_back(solve3(dict,li,ri));

   }

   //out

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


}