using System;

namespace ConsoleApp1
{
    internal class Program
    {
        struct granica
        {
            public int l;
            public int r;
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] glNiz = new int[n];
            string[] unos = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
                glNiz[i] = int.Parse(unos[i]);
            int q = int.Parse(Console.ReadLine());
            granica[] podNiz = new granica[q];
            for(int i = 0; i < q; i++)
            {
                unos = Console.ReadLine().Split();
                podNiz[i].l = int.Parse(unos[0]);
                podNiz[i].r = int.Parse(unos[1]);
            }
            for(int i = 0; i < q; i++)
            {
                int indk = -1;
                int br = 0;
                bool nemoguce = false;
                for (int ll = podNiz[i].l - 1; ll < podNiz[i].r; ll++)
                {
                    if (ll != podNiz[i].l - 1 && ll != podNiz[i].r - 1)
                    {
                        if ((glNiz[ll] > glNiz[ll + 1] || glNiz[ll] < glNiz[ll - 1]) && ll - 1 != indk)
                        {
                            if (glNiz[ll - 1] <= glNiz[ll + 1]) { br++; indk = ll; }
                            else nemoguce = true;
                        }
                    } else if (ll == podNiz[i].l - 1 && ll != podNiz[i].r - 1)
                    {
                        if (glNiz[ll] > glNiz[ll + 1]) { br++; indk = ll; }
                    }
                    else if (ll == podNiz[i].r - 1)
                    {
                        if (glNiz[ll] < glNiz[ll - 1] && ll - 1 != indk) { br++; indk = ll; }
                    }
                    if (br > 1) nemoguce = true;
                    if (nemoguce) break;
                }
                if (nemoguce) Console.WriteLine("NE");
                else Console.WriteLine("DA");
            }
        }
    }
}