#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;

	cin >> n;

	vector <int> a;
	a.push_back(0);
	for (size_t i = 0; i < n; i++)
	{
		int y;
		cin >> y;
		a.push_back(y);
	}

	int q;

	cin >> q;
	vector <pair <int, int> > pok;
	pok.push_back( { 0, 0 });
	for (size_t i = 0; i < q; i++)
	{
		pair <int, int> e;
		cin >> e.first >> e.second;
		pok.push_back(e);
	}

	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))cout << "DA" << endl;
		else cout << "NE" << endl;
	}
}

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


}