#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,k;
    cin>>n;
    vector <int> a;
    for (int i=0;i<n;i++)
    {
        cin>>k;
        a.push_back(k);
    }
    int q;
    cin>>q;
    int l,r;
    vector <int> b;
    for (int i=0;i<q;i++)
    {
        cin>>l>>r;
        for (int j=l;j<=r;j++)
        {
            b.push_back(a[j-1]);
        }
        if (l==r)
        {
            cout<<"DA"<<endl;
        }
        else
        {
            int brojac=0;
            int ok=1;
            for (int j=1;j<b.size();j++)
            {
                if (b[j-1]>b[j])
                {
                    brojac++;
                }
                if (brojac>1)
                {
                    ok=0;
                }
            }
            //cout<<brojac<<endl;
            if (ok==1)
            {
                cout<<"DA"<<endl;
            }
            else
            {
                cout<<"NE"<<endl;
            }
        }
        b.clear();
    }
}