using System;
using System.Collections.Generic;
using System.Dynamic;
namespace ConsoleApp1
{
    class Program
    {   
        struct mdma
        {
            public ulong l;
            public ulong r;
        }
        static void pisi(ulong[]a ,ulong l, ulong r)
        {
            for(ulong i=l;i<=r;i++)
                Console.Write(a[i] + " ");
            Console.WriteLine();
        }
        static bool moze(ulong [] a,ulong l,ulong r)
        {
            bool bilo = false;
            for(ulong i=l;i<=r-1;i++)
            {
                if (a[i] > a[i + 1] && bilo)
                    return false;
                else if (a[i] > a[i+1])
                    bilo = true;
            }
            return true;
        }
        static void Main(string[] args)
        {
            List <mdma>zab= new List<mdma>();
            uint n = uint.Parse(Console.ReadLine());
            ulong[] a= new ulong[n];
            string[] red = Console.ReadLine().Split(' ');
            for(uint i=0;i<n;i++)
            {
                a[i] = ulong.Parse(red[i]);
            }
            int k = int.Parse(Console.ReadLine());
            bool[] izlaz = new bool[k];
            for(int i=0;i<k;i++)
            {
                red = Console.ReadLine().Split(' ');
                ulong l = ulong.Parse(red[0]) - 1;
                ulong r = ulong.Parse(red[1]) - 1;
                bool eh = false;
                mdma z;
                z.l = l;
                z.r = r;
                //pisi(a, l, r);
                foreach(mdma x in zab)
                {
                    if (x.l >= l && x.r <= r)
                    {
                        eh = true;
                        break;
                    }

                }
                if (eh)
                    izlaz[i] = false;
                else
                {
                    izlaz[i] = moze(a, l, r);

                    if (!izlaz[i])
                    {

                        zab.Add(z);
                    }
                }
            }
            foreach (bool x in izlaz)
                if (x)
                    Console.WriteLine("DA");
                else
                    Console.WriteLine("NE");

            Console.ReadLine();
        }
    }
}