#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[r[i] - l[i]] tmp;
        for(int i = l[i]; i <= r[i]; i++)
        {
            tmp[i - l[i]] = a[i];
        }

        sort(tmp, tmp + sizeof(tmp) / sizeof(tmp[0]));

        int br = 0;

        for(int i = l[i]; i <= r[i]; i++)
        {
            if(tmp[i - l[i]] != a[i])
            {
                br++;
            }
        }

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

    }

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

}