#include <bits/stdc++.h>

using namespace std;

int main()
{
    short int n;
    cin >> n;

    short int a[n];
    for(short int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    short int q;
    cin >> q;

    short int l[q], r[q];

    for(short int i = 0; i < q; i++)
    {
        cin >> l[i] >> r[i];
        l[i]--, r[i]--;
    }

    short int manji[n][n];

    for(short int i = 0; i < n; i++)
    {
        manji[i][i] = 0;
    }

    for(short int i = 0; i < n; i++)
    {
        for(short int j = i - 1; j >= 0; j--)
        {
            if(a[j] <= a[i])
            {
                manji[i][j] = manji[i][j + 1] + 1;
            }
            else
            {
                manji[i][j] = manji[i][j + 1];
            }
        }

        for(short int j = i + 1; j < n; j++)
        {
            if(a[j] >= a[i])
            {
                manji[i][j] = manji[i][j - 1] + 1;
            }
            else
            {
                manji[i][j] = manji[i][j - 1];
            }
        }
    }

    for(short int i = 0; i < q; i++)
    {
        if(((manji[l[i]][r[i]] >= (r[i] - l[i] - 1)) || (manji[l[i]][r[i] + 1] == (r[i] - l[i] - 1)) || (manji[l[i]][r[i]] == 0)) && ((manji[r[i]][l[i]] >= (r[i] - l[i] - 1)) || (manji[r[i]][l[i] - 1] == (r[i] - l[i] - 1)) || (manji[r[i]][l[i]] == 0)))
        {
            cout << "DA" << "\n";
        }
        else
        {
            cout << "NE" << "\n";
        }
    }

}