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

using namespace std;

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

int n, q;
int a[maxn];

bool solve(int x, int y)
{
    vector<int> p, q;
    for(int i = x; i <= y; i++)
    {
        p.push_back(a[i]);
        q.push_back(a[i]);
    }
    sort(p.begin(), p.end());
    int br = 0;
    for(int i = 0; i <= y - x; i++)
    {
        if(p[i] != q[i]) br++;
        if(br > 2) return false;
    }
    return true;
}

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

    cin >> n;

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

    cin >> q;

    while(q--)
    {
        int l, r;
        cin >> l >> r;

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

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