
{$APPTYPE CONSOLE}

var sum1,sum2,t:real;
 n,k,m,i:integer;
a:array[1..10000]of real;
    bo:boolean;


begin
assign(input,'easy.in'); reset(input);
 assign(output,'easy.out');rewrite(output);
sum1:=0;
SUM2:=0;

readln(m,n,k);
for i:=1 to k do readln(a[i]);

bo:=false;
for i:=1 to k do  begin
 sum1:=sum1+a[i];
  if i>m then sum1:=sum1-a[i-m];

  sum2:=sum2+a[i];

  if i>n then sum2:=sum2-a[i-n];

  if (sum1/m>sum2/n)then begin
  if ((bo=false)and(i>=n)) then begin
 bo:=true;
  writeln('BUY ON DAY ',I);
  END; end

  ELSE
  IF  (BO=TRUE) THEN BEGIN
   BO:=FALSE;
    WRITELN('SELL ON DAY ',I);
    END;


end;



close(input);
 close(output);


end.
