#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
	int n, q;
	cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	cin >> q;
	for (int qq = 0; qq < q; qq++)
	{
		int l, r; cin >> l >> r;
		l--; r--;
		int count = 0;
		string rez = "DA";
		for (int i = l + 1; i <= r; i++)
		{
			if (a[i - 1] > a[i]) count++;
			if (count == 2) {
				rez = "NE"; break;
			}
		}
		cout << rez << endl;
	}
}