#include <iostream>
#include <vector>
using namespace std;
const int Nmax = 2e5;
const int Qmax = 1e5;
int niz[Nmax];
pair<int, int> nizQ[Qmax];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n, q;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> niz[i];
	cin >> q;
	for (int i = 0; i < q; i++)
	{
		int li, ri;
		cin >> li >> ri;
		nizQ[i].first = li - 1;
		nizQ[i].second = ri - 1;
	}

	//int* gazenja = new int[n];
	vector<pair<int,int>> gazenja(n);
	for (int i = n - 1; i >= 0; i--)
	{
		gazenja[i].first = -1;
		gazenja[i].second = -1;
		if (i != 0)
		{
			for (int j = i - 1; j >= 0; j--)
			{
				if (niz[i] < niz[j])
				{
					gazenja[i].second = j;
					break;
				}
			}
		}
		if (i != n - 1)
		{
			for (int k = i + 1; k < n; k++)
			{
				if (niz[i] > niz[k])
				{
					gazenja[i].first = k;
					break;
				}
			}
		}
	}
	gazenja[n - 1].first = -1;
	gazenja[0].second = -1;

	for (int i = 0; i < q; i++)
	{
		int izmenaD = 0, izmenaL = 0;
		for (int j = nizQ[i].first; j <= nizQ[i].second; j++)
		{
			if (gazenja[j].first != -1 && izmenaD != 2)
				if (gazenja[j].first <= nizQ[i].second)
					izmenaD++;
			if (gazenja[j].second != -1 && izmenaL != 2)
				if (gazenja[j].second >= nizQ[i].first)
					izmenaL++;
		}
		if (izmenaD >= 2 && izmenaL >= 2) cout << "NE\n";
		else cout << "DA\n";
	}

	//delete[] gazenja;
}