#include <bits/stdc++.h>

using namespace std;

std::vector<pair<long long int, pair<long long int,long long int> >> problem;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long int n, q;
    cin>>n;
    long long int a[n];
    for(long long int i=0;i<n;i++)
        cin>>a[i];
    cin>>q;
    long long int mIndex = 0, mBroj = a[0];
    long long int broj = 0, b[n] = {0};
    for(long long int i=1;i<n;i++)
    {
        if(mBroj > a[i])
        {
            long long int nIndex = mIndex;
            for(long long int j=i-1;j>mIndex;j--)
                if(a[j]>a[i])
                {
                    nIndex = j;
                    break;
                }
            problem.emplace_back(pair<long long int, pair<long long int,long long int>>(i, pair<long long int,long long int>(mIndex, nIndex)));
            b[i] = broj++;
        }
        else if(a[i] > mBroj)
        {
            mIndex = i;
            mBroj = a[i];
        }
    }

    while(q--)
    {
        long long int l, r;
        cin>>l>>r;
        l--;
        int problemi = 0;
        pair<long long int,long long int> izbaceniIndex(-1, -1);
        for(auto i=problem.begin()+b[l];i!=problem.end();i++)
            if(i->first>=l && i->first < r && l <= i->second.second && (i->second.second != izbaceniIndex.first && i->second.second != izbaceniIndex.second))
            {
                izbaceniIndex.first = i->first;
                izbaceniIndex.second = i->second.second;
                problemi++;
                if(problemi > 1)
                {
                    cout<<"NE\n";
                    break;
                }
            }
            else if(i->first >= r)
                break;

        if(problemi < 2)
            cout<<"DA\n";
    }
    return 0;
}