#include <iostream>
#include <vector>

using namespace std;

bool proveriOpadanje(vector<int> a) 
{
	int prethodni = a[0];
	for (int i = 1; i < a.size(); i++) 
	{
		if (prethodni <= a[i]) 
		{
			prethodni = a[i];
		}
		else 
		{
			return false;
		}
	}
	return true;
}

int main() 
{
	int n , q;
	cin >> n;
	int* niz = new int[n];
	for (int i = 0; i < n; i++) 
	{
		cin >> niz[i];
	}
	for (int i = 0; i < n; i++) 
	{
		cout << niz[i] << " ";
	}
	cin >> q;
	for (int i = 0; i < q; i++) 
	{
		int l, r;
		cin >> l >> r;
		l -= 1;
		vector<int> tmp;
		int prethodni = niz[l];
		for (int j = l+1; j < r; j++) 
		{
			if (prethodni <= niz[j]) 
			{
				prethodni = niz[j];
				continue;
			}
			else 
			{
				tmp.push_back(prethodni);
				for (; j < r; j++) 
				{
					tmp.push_back(niz[j]);
				}
				break;
			}
		}
		if (tmp.empty()) 
		{
			cout << "DA";
			continue;
		}
		int pom = tmp[0];
		tmp[0] = NULL;
		tmp.shrink_to_fit();
		if (proveriOpadanje(tmp)) 
		{
			cout << "DA";
			continue;
		}
		tmp.at(0) = pom;
		pom = tmp[1];
		tmp[1] = NULL;
		if (proveriOpadanje(tmp))
		{
			cout << "DA";
			continue;
		}
		else 
		{
			cout << "NE";
			continue;
		}
	}
}