#include <bits/stdc++.h>

using namespace std;

std::vector<pair<int, pair<int,int> >> problem;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, q;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    cin>>q;
    int mIndex = 0, mBroj = a[0];
    for(int i=1;i<n;i++)
    {
        if(mBroj > a[i])
        {
            int nIndex = mIndex;
            for(int j=i-1;j>mIndex;j--)
                if(a[j]>a[i])
                {
                    nIndex = j;
                    break;
                }
            problem.push_back(pair<int, pair<int,int>>(i, pair<int,int>(mIndex, nIndex)));
        }
        else if(a[i] > mBroj)
        {
            mIndex = i;
            mBroj = a[i];
        }
    }
    while(q--)
    {
        int l, r;
        cin>>l>>r;
        l--;
        int problemi = 0;
        pair<int,int> izbaceniIndex(-1, -1);
        for(auto& i:problem)
            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;
}