#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n;
    cin >> n;
    ll a[n];
    for (ll i = 0; i < n; i++)
        cin >> a[i];
    ll q;
    cin >> q;
    for (ll i = 0; i < q; i++)
    {
        ll l, r;
        cin >> l >> r;
        l--, r--;
        bool da = true;
        bool k = false;
        int tr = l;
        for (ll p = l + 1; p <= r; p++)
        {
            if (a[p] < a[tr])
            {
                if (k)
                {
                    da = false;
                    break;
                }
                if (tr > l)
                {
                    if (a[p] > a[tr - 1])
                        tr = p;
                    else
                        tr = p - 1;
                }
                else
                    tr = p;
                k = true;
            }
            else
                tr = p;
        }
        if (da == true)
            cout << "DA" << '\n';
        else
            cout << "NE" << '\n';
    }
    return 0;
}