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

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] temp = Console.ReadLine().Split();
            int[] niz = new int[n];
            for (int i = 0; i < n; i++)
            {
                niz[i] = int.Parse(temp[i]);
            }
            int q = int.Parse(Console.ReadLine());
            int[] nizovi = new int[q*2];
            for (int i = 0; i < q; i++)
            {
                temp = Console.ReadLine().Split();
                nizovi[i] = int.Parse(temp[0]);
                nizovi[i+1] = int.Parse(temp[1]);
                int l = nizovi[i] - 1;
                int d = nizovi[i+1] - 1;
                int brBrisanja=0;
                while (l<d)
                {
                    if (niz[l] <= niz[d])
                    {
                        l++;
                        d--;
                    }
                    else
                    {
                        brBrisanja++;
                        l++;
                    }
                    if (brBrisanja > 1)
                    {
                        Console.WriteLine("NE");
                        break;
                    }
                }
                if (brBrisanja <= 1) Console.WriteLine("DA");
            }
        }
    }
}