program xx;
const inp='easy.in';
     outp='easy.out';
var i,n,m,k:longint;
    s,sm,sn:array[0..10000]of double;
    a,b,c:double;
begin
 assign(input,inp); reset(input);
 assign(output,outp); rewrite(output);
 read(n,m,k);
 s[0]:=0;
 sm[0]:=0; sn[0]:=0;
 for i:=1 to k do
  begin
   read(c);
   s[i]:=s[i-1]+c;
   if i>=n then sn[i]:=(s[i]-s[i-n])/n else sn[i]:=10000;
   if i>=m then sm[i]:=(s[i]-s[i-m])/m else sm[i]:=10000;
   if i=m then if sn[i]<sm[i] then
    writeln('SELL ON DAY ',i) else
    writeln('BUY ON DAY ',i);    
   if i>m then
   if (sm[i-1]<sn[i-1])and(sm[i]>sn[i])then
    writeln('SELL ON DAY ',i) else
   if (sm[i-1]>sn[i-1])and(sm[i]<sn[i])then
    writeln('BUY ON DAY ',i);
  end;
 close(input); close(output);
end.
