program e;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var F, F2: Text;
    m, n, k : Integer;
    i, ip : Integer;
    Days : Array[1..10000] of real;
    Summ : Real;
    Pn, Pm : Real;
    gPn, lPn{, Flg} : Boolean;

function P(day, length:integer): real;
begin
  Summ := 0;
  For ip := succ(day-length) to succ(day) do begin
    Summ := Summ + Days[ip];
  End;
  Result := Summ / length;
end;

begin
  Assign(F2, 'easy.out');
  ReWrite(F2);

  Assign(F, 'easy.in');
  Reset(F);
  ReadLn(F, m, n, k);

//  Flg := false;
  lPn := false;
  gPn := false;
  For i := 1 to K do begin
    ReadLn(F, Days[i]);
    if i >= n then begin
      Pm := P(i, m);
      Pn := P(i, n);
      WriteLn('i = ',i,', Pn = ', Pn:2:2,', Pm = ',Pm:2:2);
      if Pm > Pn then begin
        if not gPn then begin
          WriteLn(F2, 'BUY ON DAY ', i);
          gPn := True;
          lPn := False;
        end;
      end
      else begin
        if Pm < Pn then begin
          if not lPn then begin
            WriteLn(F2, 'SELL ON DAY ', i);
            lPn := True;
            gPn := False;
          end;
        end;
      end;
    end;
  end;

  Close(F);

  Close(F2);
//  ReadLn;
end.
