program e1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  f1,f2:text;
  m,n,i,k,j,h:integer;
  s1,s2,pm,pn:real;

  a:array[1..10000] of real;
  pnn,pmm:array[1..10000] of real;

begin
assign(f1,'easy.in');reset(f1);
read(f1,m,n,k);
for i:=1 to k do read(f1,a[i]);
close(f1);
assign(f2,'easy.out');rewrite(f2);
for i:=n to k do begin
s1:=0;s2:=0;
 for h:=i-n+1 to i do s1:=s1+a[h];
  pnn[i]:=s1/n;
 for h:=i-m+1 to i do s2:=s2+a[h];
 pmm[i]:=s2/m;
end;
for I:=n to  k do begin
if (pmm[i]>pnn[i]) and (i=n) then begin writeln(f2,'BUY ON DAY ',i);end;
if (pmm[i]>pnn[i]) and (pmm[i-1]<pnn[i-1]) then begin writeln(f2,'BUY ON DAY ',i);end;
if (pmm[i]<pnn[i]) and (i=n) then begin writeln(f2,'SELL ON DAY ',i);end;
if (pmm[i]<pnn[i]) and (pmm[i-1]>pnn[i-1]) then begin writeln(f2,'SELL ON DAY ',i);end;
end;
close(f2);

end.
