#include <bits/stdc++.h>
#include <iostream>

using namespace std;

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

    vector<int> a(n);

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

    int q;
    cin >> q;

    vector<pair<int,int>> b(q);

    for(int i = 0; i < q; i++)
    {
        int l,d;
        cin >> l >> d;
        b[i].first = l - 1;
        b[i].second = d - l;
    }



    vector<int> r(q,0);

    vector<vector<int>> dp(n);

    for(int i = 0; i < n; i++)
    {
        vector<int> p(n-i);
        dp[i] = p;
    }

    for(int i = 0; i < n; i++) dp[0][i] = 1;

    for(int i = 1; i < n; i++)
    {
        for(int j = 0; j + i < n; j++)
        {
            dp[i][j] = (dp[i-1][j] + (a[j+i-1] <= a[j+i]))*(a[j+i-1] <= a[j+i])*(dp[i-1][j] > 0);
        }
    }

    for(int i = 0; i < q; i++)
    {
        r[i] = 0;

        if(b[i].second == 0) r[i] = 1;

        if(r[i] == 0) r[i] = dp[b[i].second - 1][b[i].first + 1];

        if(r[i] == 0)
        {
            r[i] = dp[b[i].second - 1][b[i].first];
        }

        for(int j = 0; j < b[i].second - 1 && r[i] == 0; j++)
        {
            int d0 = j, l0 = b[i].first, d1 = b[i].second - j - 2,l1 = b[i].first + j + 2;

            r[i] = dp[d0][l0]*dp[d1][l1]*(a[l0 + j] <= a[l1]);
        }
    }

    for(int i : r)
    {
        if(i == 0) cout << "NE";
        else cout << "DA";
        cout << "\n";
    }

    return 0;
}