#include <iostream>

using namespace std;

int main()
{
    int n, q;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];

    cin >> q;
    int x[q], y[q];
    for (int i = 0; i < q; i++) {
        cin >> x[i] >> y[i];
    }

    for (int i = 0; i < q; i++) {
        if (x[i] - y[i] == 0) {
            cout << "DA\n";
            continue;
        }
        int greska = 0;
        for (int j = x[i]-1; j < y[i] - 1; j++) {
            if (a[j] > a[j+1]) {
                greska++;
                if (greska > 1) {
                    cout << "NE\n";
                    break;
                }
            }
        }
        if (greska <= 1) cout << "DA\n";
    }

    return 0;
}