program pe4;

{$APPTYPE CONSOLE}

var  f :text;
        i,j,n,m :byte;
        k :word;
        mas :array of real;
        mas1 :array of word;
        pim,pin :integer;
        bullish,bearish :array of boolean;

begin
assignfile(f,'easy.in');
reset(f);
read(f,m,n,k);
setlength(mas,k);
setlength(mas1,k);
setlength(bullish,k);
setlength(bearish,k);
for i:=1 to k do readln(f,mas[i]);
for i:=1 to k do mas[i]:=mas[i]*100;
for i:=1 to k do mas1[i]:=trunc(mas[i]);
closefile(f);
assignfile(f,'easy.out');
rewrite(f);
for i:=n to k do
begin
        pim:=0;
        for j:=(i-m+1) to i do pim:=pim+mas1[j];
        pim:=round(pim*100/m);
        pin:=0;
        for j:=(i-n+1) to i do pin:=pin+mas1[j];
        pin:=round(pin*100/n);
        if (pim>=pin) then
        begin
                bullish[i]:=true;
                if ((i=n) or bearish[i-1]) then writeln(f,'BUY ON DAY ',i);
        end;
        if (pim<pin) then
        begin
                bearish[i]:=true;
                if ((i=n) or bullish[i-1]) then writeln(f,'SELL ON DAY ',i);
        end;
end;
closefile(f);
end.
