 var f:textfile;
     m,n,k:integer;
     pr:array[1..10000]of double;

procedure Prov;
 var ns,ms:double;
     i,kov:integer;
begin
 AssignFile(f,'easy.out');
 rewrite(f);
 ms:=0;
 for i:=n-m+1 to n do begin
  ms:=ms+pr[i];
 end;
 ns:=0;
 for i:=1 to n do begin
  ns:=ns+pr[i];
 end;

 if(ms*n>ns*m) then begin
  writeln(f, 'BUY ON DAY ', n);
  kov:=1;
 end else begin
  writeln(f, 'SELL ON DAY ', n);
  kov:=-1;
 end;

 for i:=n+1 to k do begin
  ms:=ms-pr[i-m]+pr[i];
  ns:=ns-pr[i-n]+pr[i];
  if(ms*n>ns*m)and(kov=-1) then begin
   writeln(f, 'BUY ON DAY ', i);
   kov:=1;
  end else if (ms*n<ns*m)and(kov=1) then begin
   writeln(f, 'SELL ON DAY ', i);
   kov:=-1;
  end;
 end;

 closefile(f);
end;
 var i:integer;
begin
 AssignFile(f,'easy.in');
 reset(f);
 readln(f,m,n,k);
 for i:=1 to k do
  readln(f,pr[i]);
 CloseFile(f);
 Prov;
end.
