using System;

namespace A1
{
    class Program
    {
        static bool metoda(int[] a, int l, int d)
        {
            if (l == d)
                return true;
            bool provera = true;
            while (l < d)
            {
                if (a[l] <= a[d])
                {
                    l++;
                    d--;
                }
                else if (a[l] > a[d] && provera)
                {
                    l++;
                    provera = false;
                }
                else
                    return false;
            }
            return true;
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            string[] s = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
                a[i] = int.Parse(s[i]);
            int q = int.Parse(Console.ReadLine());
            for (int i = 0; i < q; i++)
            {
                s = Console.ReadLine().Split();
                int l = int.Parse(s[0]);
                int r = int.Parse(s[1]);
                Console.WriteLine(metoda(a, l - 1, r - 1) ? "DA" : "NE");
            }
        }
    }
}