#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;


bool Proveri(vector <int> a)
{
	for (size_t i = 0; i < a.size(); i++)
	{
		vector <int> e = a;
		e.erase(e.begin() + i);
		vector <int> c = e;
		sort(c.begin(), c.end());
		if (e == c)
			return true;
	}
	return false;
}


void Poklon()
{
	int n;

	scanf("%d",&n);

	vector <int> a(n+1,0);
	for (size_t i = 1; i <= n; i++)
		scanf("%d", &a[i]);
		
	

	int q;

	scanf("%d", &q);

	vector <pair <int, int> > pok(q+1,{0,0});
	for (size_t i = 1; i <= q; i++)
		scanf("%d %d", &pok[i].first,&pok[i].second);
		
	

	for (size_t i = 1; i <= q; i++)
	{
		vector <int> e;

		for (size_t j = pok[i].first; j <= pok[i].second; j++)
			e.push_back(a[j]);

		if (Proveri(e))printf("DA \n");
		else printf("NE \n");
	}
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	Poklon();


}