{$A+,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MAXSTACKSIZE $3C00000}
{$APPTYPE CONSOLE}
type
 int = integer;
 real = extended;

var
 s : array[1..10000] of real;
 pm, pn : array[1..10000] of real;
 x : real;
 i, n, m, k : int;

begin
 assign(input,'easy.in');reset(input);
 assign(Output,'easy.out');rewrite(output);
 read(m,n,k,s[1]);
 for i := 2 to k do
  begin
   read(x);
   s[i] := s[i - 1] + x;
  end;
 FillChar(pm,sizeof(pm),0);
 FillChar(pn,sizeof(pn),0);
 for i := n to k do
  pn[i] := (s[i] - s[i - n]) / n;
 for i := m to k do
  pm[i] := (s[i] - s[i - m]) / m;
 if pm[n] > pn[n] then
  writeln('BUY ON DAY ',n)
 else
  writeln('SELL ON DAY ',n);
 for i := n + 1 to k do
  begin
   if (pm[i] > pn[i]) and (pm[i - 1] < pn[i - 1]) then
    writeln('BUY ON DAY ', i);
   if (pm[i] < pn[i]) and (pm[i - 1] > pn[i - 1]) then
    writeln('SELL ON DAY ', i);
  end;
end.
