using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
  internal class Program
  {
    static string Metoda(int[] s, int r, int l)
    {
      int counter = 0;
      List<int> rlniz = new List<int>();
      for (int i = l - 1; i < r; i++)
      {
        rlniz.Add(s[i]);
      }

      for (int i = 0; i < rlniz.Count; i++)
      {
        List<int> temp = new List<int>();
        temp.Clear();
        for (int j = 0; j < rlniz.Count; j++)
        {
          temp.Add(rlniz[j]);
        }

        temp.Remove(temp[i]);
        for (int j = 0; j < temp.Count -1; j++)
        {
          if (temp[j] > temp[j + 1])
          {
            counter++;
            break;
          }
        }
      }
      if (counter == rlniz.Count) return "NE";
      return "DA";
    }
    
    public static void Main(string[] args)
    {
      int n = int.Parse(Console.ReadLine());
      int[] a = new int[n];
      string linija2 = Console.ReadLine();
      string[] niz = linija2.Split();
      for (int i = 0; i < n; i++)
      {
        a[i] = int.Parse(niz[i]);
      }
      int q = int.Parse(Console.ReadLine());
      int[,] rl = new int[q, 2];
      for (int i = 0; i < q; i++)
      {
        string unos = Console.ReadLine();
        string[] unostemp = unos.Split();
        rl[i, 0] = int.Parse(unostemp[0]);
        rl[i, 1] = int.Parse(unostemp[1]);
      }

      for(int i = 0; i < q; i++)
      {
        Console.WriteLine(Metoda(a, rl[i,1], rl[i,0]));
      }
    }
  }
}