{.$define debug}

{$apptype console}

{$ifdef debug}
{$R+,S+,Q+,I+,O-}
{$else}
{$R+,S-,Q+,I-,O+}
{$endif}

{$assertions on}
{$apptype console}

program template;
uses
 SysUtils;
const
 kmax = 15000;
 {$ifdef debug}
 cinfile = 'input.txt';
 coutfile = 'output.txt';
 {$else}
 cinfile = 'easy.in';
 coutfile = 'easy.out';
 {$endif}
type
 int = longint;
 real = extended;
var
 n :int;
 m :int;
 k :int;
 p :array [1..kmax] of real;
 pm,pn :real;
 last :int;
 ans :int;

procedure init;
begin
 fillchar (n,integer(@ans) - integer(@n),0);
 ans := 0;
end;

procedure readdata;
var i,j :int;
begin
 assign (input,cinfile);
 reset (input);
 read (m,n,k);
 for i := 1 to k do
  read (p[i]);
 close (input);
end;

procedure test (day :int);
var ns :int;
begin
 if (pn/n > pm/m) then
  ns := 1
 else
 if (pm/m > pn/n) then
  ns := 2
 else
  ns := 0;
 if (ns <> last) then
  case ns of
   1: writeln ('SELL ON DAY ',day); 
   2: writeln ('BUY ON DAY ',day);
  end;
 last := ns;    
end;

procedure solve;
var i,j :int;
begin
 for i := 1 to m do
  begin
   pm := pm + p[i];
   pn := pn + p[i];
  end;
 for i := m+1 to n do
  begin
   pn := pn + p[i];
   pm := pm + p[i] - p[i - m];
  end; 
 assign (output,coutfile);
 rewrite (output);
 test (n);
 for i := n+1 to k do
  begin
   pn := pn + p[i] - p[i - n];
   pm := pm + p[i] - p[i - m];
   test (i);
  end;
 close (output);  
end;

begin
 init;
 readdata;
 solve;
end.
