using System;

namespace Petlja
{
    class Program
    {

        static string Ispitaj(int x, int y, int[] a, int[] b, int[] c)
        {
            if (b[x] == b[y] || y - x == 1)
            {
                return "DA";
            }
            if (b[y] - b[x] == 1)
            {
                if (((c[y] - 2 < x || a[c[y] - 2] <= a[c[y]]) && (c[y] + 1 > y || a[c[y]] <= a[c[y] + 1])) || ((c[y] - 2 < x || a[c[y] - 2] <= a[c[y]] - 1) && (c[y] + 1 > y || a[c[y] - 1] <= a[c[y] + 1])))
                {
                    return "DA";
                }
            }
            return "NE";
        }

        static void Main(string[] args)
        {
            int z = -1, n = int.Parse(Console.ReadLine());
            int[] a = new int[n], b = new int[n], c = new int[n];
            string[] s = Console.ReadLine().Split();
            a[0] = int.Parse(s[0]);
            for (int i = 1; i < n; i++)
            {
                a[i] = int.Parse(s[i]);
                b[i] = b[i - 1];
                if (a[i - 1] > a[i])
                {
                    b[i]++;
                    z = i;
                }
                c[i] = z;
            }
            int q = int.Parse(Console.ReadLine());
            for (int i = 0; i < q; i++)
            {
                s = Console.ReadLine().Split();
                int x = int.Parse(s[0]) - 1, y = int.Parse(s[1]) - 1;
                Console.WriteLine(Ispitaj(x, y, a, b, c));
            }

        }
    }
}