program Untitled;
var
   n, c, i, j, s, k, m, z, a, b : longint;
   boja : string;
   bo : array [ 1..300000 ] of longint;
   isp : array [ 1..10000 ] of string;
begin
     readln ( n, c );
     for i := 1 to n do
         read ( bo[i] );
     readln;
     readln ( m );
     for i := 1 to m do
     begin
          readln ( a, b );
               for j := a to b do
               begin
                    s := 0;
                    for k := a to b do
                    begin
                        if bo[j] = bo[k] then s := s + 1;
                        if s > ((b - a) + 1) div 2 then break;
                    end;
                    if ( z = 0 ) and ( s > ((b - a) + 1) div 2 ) then
                    begin
                         str ( bo[j], boja );
                         isp[i] := 'da ' + boja;
                         z := 1;
                    end;
                    if z = 1 then break;
               end;
               if z = 0 then isp[i] := 'ne';
               z := 0;
     end;
     for i := 1 to m do
         writeln ( isp[i] );
readln;
end.
