#include <bits/stdc++.h>

using namespace std;

const int maxn = 2e5;
const int maxq = 1e5;

int n, q;
int a[maxn];

bool solve(int x, int y)
{
    int br = 0;
    for(int i = x; i < y; i++)
    {
        if(a[i + 1] < a[i]) br++;
        if(br > 1) return false;
    }
    return true;
}

int main()
{
    ios_base::sync_with_stdio(false);

    cin >> n;
    assert(n > 0 && n <= maxn);

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

    cin >> q;
    assert(q > 0 && q <= maxq);

    while(q--)
    {
        int l, r;
        cin >> l >> r;
        assert(l > 0 && l <= r && r <= n);

        bool ans;
        ans = solve(l, r);

        ans ? cout << "DA" << endl : cout << "NE" << endl;
    }
    return 0;
}