#include <iostream>
#include <bits/stdc++.h>
#include <queue>

using namespace std;

int main()
{
    int n,q,i,x,y,j;
    cin>>n;
    cin>>x;
    vector<int> a;
    vector<int> l;
    l.push_back(x);
    //vector<int> r;
    for(i=1;i<n;i++){
        cin>>y;
        if(x>y){
            a.push_back(i);
            a.push_back(i+1);
        }
        l.push_back(y);
        //r.push_back(y);
        x=y;
    }
    /*for(i=0;i<a.size();i++){
        cout<<a[i];
    }*/
    cin>>q;
    priority_queue<pair<int,int> > b;
    priority_queue<pair<int,int> > e;
    pair<int,int> c;
    pair<int,int> f;
    vector<int> g;
    for(i=0;i<q;i++){
        cin>>x>>y;
        c.first=-x;
        c.second=-y;
        b.push(c);
    }
    vector<vector<int> > d(n+1);
    x=1;
    for(i=1;i<=n;i++){
        c=b.top();
        if(-c.first==i){
            b.pop();
            f.second=x;
            g.push_back(x);
            x++;
            f.first=c.second;
            e.push(f);

        }
        for(j=0;j<g.size();j++){
            d[i].push_back(g[j]);
        }

        f=e.top();
        if(-f.first==i){
            e.pop();
            y=f.second;
            for(j=0;j<g.size();j++){
                //cout<<i<<g[j];
                if(y==g[j]){
                    break;
                }
            }

            g.erase(g.begin()+j);
        }
    }
    vector<int>m(q+1);
    for(i=0;i<a.size();i++){
        x=a[i];
        //cout<<x;
        for(j=0;j<d[x].size();j++){
            //cout<<d[x][j]<<" ";
            m[d[x][j]]++;
        }
        //cout<<endl;
    }
    for(i=1;i<=q;i++){
        if(m[i]>4){
            cout<<"NE\n";
        }
        else if(m[i]==4){
            x=l[i-1];
            y=0;
            for(j=0;j<a.size();j++){
                if(x==a[j]){
                    y++;
                    if(x+1!=a[j+1]){
                        y++;
                    }
                    break;
                }
            }
            if(y==2){
                cout<<"DA\n";
            }
            else{
                cout<<"NE\n";
            }
        }
        else{
            cout<<"DA\n";
        }
    }
}