using System;

namespace Okruzno_takmicenje___2022_02_26
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            string[] temp = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(temp[i]);
            }
            int q = int.Parse(Console.ReadLine());
            for (int i = 0; i < q; i++)
            {
                temp = Console.ReadLine().Split(' ');
                int l = int.Parse(temp[0]) - 1;
                int r = int.Parse(temp[1]) - 1;
                int pret1 = 0;
                int pret2 = a[l + 1];
                int count1 = 0;
                int count2 = 0;
                for (int j = l; j <= r; j++)
                {
                    if (a[j] >= pret1) pret1 = a[j];
                    else count1++;
                    if (j != l && a[j] >= pret2) pret2 = a[j];
                    else count2++;
                }
                int c = Math.Min(count1, count2);
                if (c == 1 || c == 0) Console.WriteLine("DA");
                else Console.WriteLine("NE");
            }
        }
    }
}