#include <stdio.h>
#include <iostream>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
using namespace std;

int n, q;
vector<int> a, d;
vector<bool> b, c;
vector<pair<int, int>> t;


int main() {
	int i, j, x, y;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> x; a.push_back(x);
	}

	cin >> q;
	for (i = 0; i < q; i++) {
		cin >> x >> y; x--; y--;
		t.push_back(make_pair(x, y));
	}

	for (i = 0; i < n - 2; i++) {
		b.push_back(a[i] > a[i + 1]);
		c.push_back(a[i] > a[i + 2]);
	}

	b.push_back(a[n - 2] > a[n - 1]);

	d.push_back(b[0] + c[0]);

	for (i = 1; i < n - 2; i++) {
		if (b[i] && c[i]) {
			d.push_back(2);
		}
		else if (b[i] && !b[i + 1]) {
			d.push_back(1);
		}
		else d.push_back(0);
	}
	d.push_back(0);
	d.push_back((a[n - 1] < a[n - 2]) * 2);

	for (i = 0; i < q; i++) {
		int s = 0;
		for (j = t[i].first; j < t[i].second; j++) {
			s += d[j];
		}
		if (s > 2)cout << "NE\n";
		else cout << "DA\n";
	}

	return 0;
}