#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];
    }

    vector<int> dp(n);

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

    int q;
    cin >> q;

    vector<int> r(q,0);

    for(int i = 0; i < q; i++)
    {
        int l,d;
        cin >> l >> d;
        d -= l;
        l--;

        r[i] = 0;

        if(d <= 1) r[i] = 1;

        if(r[i] == 0) r[i] = (dp[l + 1] >= d);

        if(r[i] == 0) r[i] = (dp[l] >= d - 1);

        for(int j = 0; j < d - 1 && dp[l] >= j && r[i] == 0; j++)
        {
            int g = (dp[l+j+2] >= (d - j - 2)), h = (a[l+j] <= a[l+j+2]);
            r[i] = g * h;
        }
    }

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

    return 0;
}