#include <bits/stdc++.h>

using namespace std;

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

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

    int q;
    cin >> q;

    int l[q], r[q];

    vector<string> res;

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

        int tmp[r[i] - l[i] + 1];
        for(int j = l[i]; j <= r[i]; j++)
        {
            tmp[j - l[i]] = a[j];
        }

        sort(tmp, tmp + (sizeof(tmp) / sizeof(tmp[0])));
        int br = 0;
        for(int j = l[i]; j <= r[i]; j++)
        {
            if(tmp[j - l[i]] != a[j])
            {
                br++;
            }
        }

        if(br > 2)
        {
            res.push_back("NE");
        }
        else
        {
            res.push_back("DA");
        }

    }

    for(auto e : res)
    {
        cout << e << "\n";
    }

}