using System;

namespace ConsoleApp2
{
    internal class Program
    {
        static void Main(string[] args)
        {
            /*  string s11 = Console.ReadLine();
              string[] s1 = s11.Split(" ");

              long N=0;
              long M=0;

              N = long.Parse(s1[0]);
              N = long.Parse(s1[1]);

              long[] a = new long[N];
              long[] b = new long[M];

              string s;

              for (long i = 0; i < 2*N+2*M; i+=2)
              {
                  s = Console.ReadLine();
                  s1 = s.Split(" ");

                  if (i<2*N)
                  {
                      a[i]=long.Parse(s1[0]);
                      a[i] = long.Parse(s1[1]);
                  }
                  else
                  {
                      b[i] = long.Parse(s1[0]);
                      b[i] = long.Parse(s1[1]);
                  }
              }
            */

            long a = long.Parse(Console.ReadLine());
            long[] N = new long[a];
            string s11 = Console.ReadLine();
            string[] s1 = s11.Split(" ");

            for (long i = 0; i < a; i++)
            {
                N[i] = long.Parse(s1[i]);
            }
            
             long h = long.Parse(Console.ReadLine());
            long x, y;
            int zlj = 0;
           
            bool jest = true;
            long[] uporedi, uporedi1,uporedi2;
            for (int i = 0; i < h; i++)
            {
                 s11 = Console.ReadLine();
                 s1 = s11.Split(" ");
                x = long.Parse(s1[0]);
                y= long.Parse(s1[1]);
                uporedi = new long[y - x + 1];
                for (int j = 0; j < y-x+1; j++)
                {
                    
                    uporedi[j] = N[x + j - 1];
                }

                for (int m = 0; m < y-x+1; m++)
                {
                    uporedi1 = new long[y - x];

                    for (int f = 0; f < y - x +1; f++)
                    {


                        if (f!=m)
                        {
                            uporedi1[f-zlj] = uporedi[f];
                        }
                        else
                        {
                            zlj++;
                         
                        }
                                


                    }
                    zlj = 0;
                    uporedi2 = new long[uporedi1.Length];
                    for (int Q = 0; Q < uporedi2.Length; Q++)
                    {
                        uporedi2[Q] = uporedi1[Q];
                    }
                    Array.Sort(uporedi2);
                    for (int Q = 0; Q < uporedi2.Length; Q++)
                    {
                       if( uporedi2[Q] != uporedi1[Q])
                        {
                            jest = false;
                        }
                    }

                }

                if (jest)
                {
                    Console.WriteLine("DA");
                }
                else
                {
                    Console.WriteLine("NE");
                }
                jest = true;
            }

        }
    }
}