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

namespace proba
{
    internal class Program
    {
        static void Test(int l, int r, int[] A, int N)
        {
            int[] B = new int[N];
            int brojac = 0;
            int broj = 0;
            for(int i = l; i < r; i++)
            {
                if (A[i - 1] > A[i] && broj != 2)
                {
                    broj++;
                }
                else if(broj == 2)
                {
                    Console.WriteLine("NE");
                    break;
                }
            }
            if(broj != 2)
            {
                Console.WriteLine("DA");
            }
        }
        static void Main(string[] args)
        {
            int N, Q;
            N = int.Parse(Console.ReadLine());
            int[] A = new int[N];
            var a = Console.ReadLine().Split();
            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse(a[i]);
            }
            Q = int.Parse(Console.ReadLine());
            for(int i = 0; i < Q; i++)
            {
                var proba = Console.ReadLine().Split();
                int l = int.Parse(proba[0]);
                int r = int.Parse(proba[1]);
                Test(l, r, A, N);
            }
        }
    }
}