using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    struct Granica
    {
        public int l;
        public int r;
    }

    internal class Program
    {

        public static bool DaLiMoze (int a, int b, int[] niz)
        {
            int nemoze = 0;
            for (int i = a; i < b; i++)
            {
                if (niz[i - 1] > niz[i])
                {
                    nemoze++;
                    if (nemoze == 2) return false;
                }
            }
            return true;
        }

        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] nizStr = Console.ReadLine().Split();
            int[] niz = new int[n] ;
            for (int i = 0; i < n; i++)
            {
                niz[i] = Convert.ToInt32(nizStr[i]);
            }

            int q = Convert.ToInt32(Console.ReadLine());
            Granica[] granice = new Granica[q];
            for (int i = 0; i < q; i++)
            {
                nizStr = Console.ReadLine().Split();
                granice[i].l = Convert.ToInt32(nizStr[0]);
                granice[i].r = Convert.ToInt32(nizStr[1]);
            }

            for (int i = 0; i < q; i++)
            {
                if (granice[i].l == granice[i].r) Console.WriteLine("DA");
                else if (DaLiMoze(granice[i].l, granice[i].r, niz)) Console.WriteLine("DA");
                else Console.WriteLine("NE");
            }
        }
    }
}