#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int a[200000];
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    int q, x, y, br = 0;
    cin >> q;
    for(int i = 0; i < q; i++) {
        cin >> x;
        cin >> y;
        for (int j = x; j < y; j++) {
            if (a[j] < a[j - 1]) {
                br++;
            }
            if (a[j] == a[j - 1] && a[j - 2] > a[j - 1] && j - 3 >= x) {
                br++;
            }
        }
        if (br > 1) {
            cout << "NE" << endl;
        }
        else {
            cout << "DA" << endl;
        }
        br = 0;
    }

}