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

    internal class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] glavni = new int[n];
            string[] unos = Console.ReadLine().Split();
            for(int i = 0;i < n;i++)
            {
                glavni[i] = Convert.ToInt32(unos[i]);
            }

            int q = Convert.ToInt32(Console.ReadLine());
            List<int> niz = new List<int>();
            string[] ispis = new string[q];
            int l, r;
            int br = 1;
            for (int i = 0; i < q; i++)
            {
                unos = Console.ReadLine().Split();
                l = Convert.ToInt32(unos[0]);
                r = Convert.ToInt32(unos[1]);
                if(l == r)
                {
                    ispis[i] = "DA";
                    break;
                }
                for(int j = l-1;j<r;j++)
                {
                    niz.Add(glavni[j]);
                }

                for(int j = 1;j<niz.Count;j++)
                {
                    if (niz[j-1] > niz[j] && br == 1)
                    {
                        br = 0;
                        continue;
                    }
                    else if (niz[j - 1] > niz[j] && br == 0)
                    {
                        br = 1;
                        ispis[i] = "NE";
                        break;
                    }
                    else if(j == niz.Count-1 || l == r)
                    {
                        ispis[i] = "DA";
                        break;
                    }
                }

                niz.Clear();
                br = 1;
            }


            for (int i = 0; i < q; i++)
            {
                Console.WriteLine(ispis[i]);
            }
            Console.ReadLine();
        }
    }