#include <bits/stdc++.h>
#define en '\n'

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector <int> A (N + 1);
    A[0] = 0;
    vector <int> B (N + 1);
    B[0] = 0;
    vector <int> C (N + 1);
    C[0] = 0;
    for (int i = 1; i <= N; i++)
    {
        cin >> A[i];
        B[i] = B[i - 1];
        if (A[i - 1] > A[i])
            B[i]++;
        C[i] = C[i - 1];
        if (i > 1 && i < N && A[i - 1] > A[i] && A[i - 2] > A[i] && A[i - 1] > A[i + 1])
            C[i]++;
    }
    int Q;
    cin >> Q;
    for (int i = 0; i < Q; i++)
    {
        int l, r;
        cin >> l >> r;
        int x = B[r] - B[l];
        int y = C[r] - C[l];
        if (x <= 1 && y <= 0)
            cout << "DA" << en;
        else
            cout << "NE" << en;
    }
}