program pe;

{$APPTYPE CONSOLE}
uses SysUtils;
const
 Filec='easy';
 Filei=Filec+'.in';
 Fileo=Filec+'.out';
const
 buys = 'BUY ON DAY %d';
 sells = 'SELL ON DAY %d';
var
 p,pn,pm: array of Single;
 i,n,m,k: Integer;
// Buy,Sell: Integet;
begin
 Assign(input,Filei); Reset(input);
 Assign(output,Fileo);Rewrite(output);
 Readln(m,n,k);
 SetLength(P,k);
 SetLength(Pn,k-n);
 SetLength(Pm,k-n);
 for i:=Low(p) to High(p) do begin
   Readln(p[i]);
 end;
 pm[0]:=0;
 for i:=n-1 downto n-m do begin
  pm[0]:=pm[0]+p[i];
 end;
 pn[0]:=0;
 for i:=0 to n-1 do begin
  pn[0]:=pn[0]+p[i];
 end;
 if pm[0]/m> pn[0]/n then begin
    WriteLN(format(buys,[n]));//Buy:=n;
 end else begin
    WriteLN(format(sells,[n]));//Sell:=n;
 end;
 for i:=1 to high(pm) do begin
   Pm[i]:=Pm[i-1]-P[i+n-m-1]+P[i+n-1];
   Pn[i]:=Pn[i-1]-P[i-1]+P[i+n-1];
   if Pm[i]/m>Pn[i]/n then begin
     if Pm[i-1]/m<Pn[i-1]/n then begin
       WriteLN(format(buys,[i+n]));//Buy:=n;
     end;
   end else if Pm[i-1]/m>Pn[i-1]/n then begin
          WriteLN(format(sells,[i+n]));//Buy:=n;
        end;
 end;
 Close(input);Close(output);
end.
