program EEEEEEEEEEE;
{$APPTYPE CONSOLE}
uses  SysUtils;
const _NAME='easy';

var m, n, k: Integer;
    p:array[1..10000] of Real;
    pm, pn, sn, sm: Real;
    i, j: Integer;
    buy, sell: Boolean;
    Fout: Text;

procedure Input;
var F: Text;
begin
  Assign(F, _NAME+'.in');
  Reset(F);
  ReadLn(F, m, n, k);
  for i:=1 to k do ReadLn(F, p[i]);
  Close(F);
end; // Input



begin
  Input;
  Assign(Fout, _NAME+'.out');
  ReWrite(Fout);
  sn:=0; sm:=0; buy:=True; sell:=True;

  for i:=1 to k do begin
    sm:=sm+p[i];
    if (i-m)>0 then sm:=sm-p[i-m];
    sn:=sn+p[i];
    if (i-n)>0 then sn:=sn-p[i-n];

    if i>=n then begin
       pm:=sm/(m);
       pn:=sn/(n);
       if (pm>pn) and (buy) then begin
         buy:=False;
         sell:=True;
         Writeln(Fout, 'BUY ON DAY ', i);
       end;
       if (pm<pn) and (sell) then begin
         buy:=True;
         sell:=False;
         WriteLn(Fout, 'SELL ON DAY ', i);
       end;
    end;


  end;

  Close(Fout);
end.
