program ETrading;

{$APPTYPE CONSOLE}

const
 fs='BUY ON DAY ';
 ss='SELL ON DAY ';

var
 i,k,j,l,m,n:integer;
 pr:array[0..10000] of real;
 pm,pn:array[0..10000] of real;
 trend:array[0..10000] of byte;
 sum:real;
 label ex;


begin
 assign(input,'easy.in');
 assign(output,'easy.out');
 reset(input);
 rewrite(output);

 readln(m,n,k);

 for i:=1 to k do
   begin
    readln(pr[i]);
    if i>=n then begin
      sum:=0;
      for j:=i downto i-n+1 do
       begin
        sum:=sum+pr[j];
        if i-j+1=m then pm[i]:=sum/m;
       end;
      pn[i]:=sum/n;
      if pn[i]<pm[i] then trend[i]:=0 else trend[i]:=1;

      if trend[i]=0 then
       begin
        if i=n then writeln(fs,i)
        else
          if trend[i-1]=1 then writeln(fs,i);
       end
      else
       begin
        if i=n then writeln(ss,i)
        else
         if trend[i-1]=0 then writeln(ss,i);
       end;
   end;
   end;

ex:
 close(input);
 close(output);
end.

