#include <iostream>

using namespace std;

int main()
{
    int N;
    cin >> N;
    char B[N];
    int l, c;
    B[0] = 0;
    cin >> l;
    for (int i = 1; i < N; ++i) {
        cin >> c;
        if (c < l) {
            B[i] = 1;
        }
        else {
            B[i] = 0;
        }
        l = c;
    }
    int Q, L, R;
    int ans[N];
    for (int i = 0; i < N; ++i) {
        ans[i] = N;
    }
    char d;
    int T = N;
    for (int i = N - 2; i >= 0; --i) {
        d = 0;
        for (int j = i + 1; j < T; ++j) {
            d+=B[j];
            if (d >= 2) {
                for (int p = i; p >= 0; --p) {
                    ans[p] = j;
                }
                T = j;
                break;
            }
        }
    }
    cin >> Q;
    for (int q = 0; q < Q; ++q) {
        cin >> L >> R;
        if (R-1 >= ans[L-1]) cout << "NE\n";
        else cout << "DA\n";
    }
    return 0;
}