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

namespace Program
{

    class Program
    {
        static bool solve(int[] A, int l, int r)
        {
            int i, br = 0;
            for (i = l - 1; i < r - 1; i++)
            {
                if (A[i] > A[i + 1]) br++;
                if (br == 2) return false;
            }
            return true;
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] A = new int[n];
            var linija = Console.ReadLine().Split(' ');
            int i, l, r;
            for (i = 0; i < n; i++)
            {
                A[i] = int.Parse(linija[i]);
            }
            int Q = int.Parse(Console.ReadLine());
            while (Q > 0)
            {
                var linija1 = Console.ReadLine().Split(' ');
                l = int.Parse(linija1[0]);
                r = int.Parse(linija1[1]);

                if (solve(A, l, r)) { Console.WriteLine("DA"); }
                else Console.WriteLine("NE");

                Q--;
            }
        }
    }
}