#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;
    char d[N][N];
    int T = N;
    for (int i = 0; i < N; ++i) {
        d[i][i] = 0;
    }
    for (int i = N - 2; i >= 0; --i) {
        for (int j = i + 1; j < T; ++j) {
            d[i][j] = d[i][j - 1] + B[j];
            if (d[i][j] >= 2) {
                for (int p = i; p >= 0; --p) {
                    for (int r = j; r < T; ++r) {
                        d[p][r] = 2;
                    }
                }
                T = j;
                break;
            }
        }
    }
    cin >> Q;
    for (int q = 0; q < Q; ++q) {
        cin >> L >> R;
        if (d[L-1][R-1] >= 2) cout << "NE\n";
        else cout << "DA\n";
    }
    return 0;
}