#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define sc second
#define pb push_back
#define pii pair<int,int>
#define pll pair<pll,pll>
#define MAXN 200007
ll a[MAXN],pos[MAXN],prefraste[MAXN],prefopada[MAXN],prefmin[MAXN],prefmax[MAXN];
bool lokmax[MAXN],lokmin[MAXN],raste[MAXN],opada[MAXN];
vector<ll> v[MAXN],vmax,vmin;
int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    ll n; cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    v[0].pb(0); a[0]=0;
    ll itr=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]==a[i-1]) v[itr].pb(a[i]);
        else
        {
            itr++;
            v[itr].pb(a[i]);
        }
        pos[i]=itr;
    }
    itr++; v[itr].pb(LLONG_MAX);
    pos[0]=0; pos[n+1]=itr;
    for(int i=1;i<itr;i++)
    {
        if(v[i-1][0]<v[i][0] && v[i][0]<v[i+1][0]) raste[i]=true;
        else if(v[i-1][0]<v[i][0] && v[i][0]>v[i+1][0])
        {
            lokmax[i]=true;
            vmax.pb(i);
        }
        else if(v[i-1][0]>v[i][0] && v[i][0]>v[i+1][0]) opada[i]=true;
        else
        {
            lokmin[i]=true;
            vmin.pb(i);
        }
    }
    for(auto x:vmax) cout<<x<<" ";
    cout<<endl;
    for(auto x:vmin) cout<<x<<" ";
    cout<<endl;
    for(int i=1;i<itr;i++)
    {
        prefraste[i]=prefraste[i-1]+raste[i];
        prefopada[i]=prefopada[i-1]+opada[i];
        prefmax[i]=prefmax[i-1]+lokmax[i];
        prefmin[i]=prefmin[i-1]+lokmin[i];
    }
    ll q,l,r; cin>>q;
    for(int i=0;i<q;i++)
    {
        cin>>l>>r;
        ll rez=1;
        ll l1=pos[l],r1=pos[r];
        if(pos[l]!=pos[r])
        {
            ll bropada=prefopada[r1-1]-prefopada[l1];
            ll brmax=prefmax[r1-1]-prefmax[l1];
            ll brmin=prefmin[r1-1]-prefmin[l1];
            if(0<v[pos[l1]][0] && v[pos[l1]][0]>v[pos[l1]+1][0]) brmax++;
            else if(0>v[pos[l1]][0] && v[pos[l1]][0]>v[pos[l1]+1][0]) bropada++;
            else if(0>v[pos[l1]][0] && v[pos[l1]][0]<v[pos[l1]+1][0]) brmin++;
            if(v[pos[r1]-1][0]<v[pos[r1]][0] && v[pos[r1]][0]>LLONG_MAX) brmax++;
            else if(v[pos[r1]-1][0]>v[pos[r1]][0] && v[pos[r1]][0]>LLONG_MAX) bropada++;
            else if(v[pos[r1]-1][0]>v[pos[r1]][0] && v[pos[r1]][0]<LLONG_MAX) brmin++;
            //cout<<bropada<<" "<<brmin<<" "<<brmax<<endl;
            if(bropada>0) rez=0;
            else if(brmin+brmax>=3) rez=0;
            else if(brmin+brmax==2)
            {
                auto pmin=lower_bound(vmin.begin(),vmin.end(),l1+1);
                auto pmax=lower_bound(vmax.begin(),vmax.end(),l1+1);
                ll posmin=vmin[pmin-vmin.begin()],posmax=vmax[pmax-vmax.begin()];
                //cout<<posmax<<" "<<posmin<<endl;
                if(posmax>pos[r-1] || pmax==vmax.end())
                {
                    if(v[pos[r1]-1][0]<v[pos[r1]][0] && v[pos[r1]][0]>LLONG_MAX) posmax=pos[r1];
                    else if(0<v[pos[l1]][0] && v[pos[l1]][0]>v[pos[l1]+1][0]) posmax=pos[l1];
                }
                if(posmin>pos[r-1] || pmin==vmin.end())
                {
                    if(v[pos[r1]-1][0]>v[pos[r1]][0] && v[pos[r1]][0]<LLONG_MAX) posmin=pos[r1];
                    else if(0>v[pos[l1]][0] && v[pos[l1]][0]<v[pos[l1]+1][0]) posmin=pos[l1];
                }
                //cout<<posmax<<" "<<posmin<<endl;
                if(posmax>pos[l] && posmin<pos[r] && (v[posmax-1][0]>v[posmax+1][0] || v[posmin-1][0]>v[posmin+1][0])) rez=0;
            }
        }
        if(rez==1) cout<<"DA"<<endl;
        else cout<<"NE"<<endl;
    }
    return 0;
}