program blank;

{$APPTYPE CONSOLE}
{$D-,L-,I-,S-,Q-,R-,P-}
uses
  SysUtils;
const
  taskid='easy';
  infile=taskid+'.in';
  outfile=taskid+'.out';
  maxn=10010;

var m,n,k   : longint;
    a,pm,pn : array[1..maxn] of extended;

{--------------------------------------------------------------------}
Procedure Lesen;
 var i: longint;
Begin
  assign(input,infile);
  reset(input);
  read(m,n,k);
  for i:=1 to k do
   begin
     read(a[i]);
   end;
  close(input)
end;
{--------------------------------------------------------------------}
Function max(a,b: longint): longint;
begin
  if a>b then max:=a else max:=b;
end;
{--------------------------------------------------------------------}
Procedure Run;
 var i,q : longint;
     sum : extended;
     f   : longint;
Begin
  sum:=0;
  for i:=1 to m do sum:=sum+a[i];
  pm[m]:=sum/m;
  for i:=m+1 to k do
   begin
     pm[i]:=(pm[i-1]*m-a[i-m]+a[i])/m;
   end;

  sum:=0;
  for i:=1 to n do sum:=sum+a[i];
  pn[n]:=sum/n;
  for i:=n+1 to k do
   begin
     pn[i]:=(pn[i-1]*n-a[i-n]+a[i])/n;
   end;
  f:=max(n,m);
  if pm[f]>pn[f] then
   begin
     q:=1;
     writeln('BUY ON DAY ',f);
   end else
   begin
     q:=2;
     writeln('SELL ON DAY ',f);
   end;
  for i:=f+1 to k do
   begin
     if (q=2)and(pm[i]>pn[i]) then
      begin
        q:=1;
        writeln('BUY ON DAY ',i);
      end else
     if (q=1)and(pn[i]>pm[i]) then
      begin
        q:=2;
        writeln('SELL ON DAY ',i);
      end;
   end;
end;
{--------------------------------------------------------------------}
begin
  assign(input,infile);  reset(input);
  assign(output,outfile);  rewrite(output);
  lesen;
  run;
  close(input);
  close(output);
end.
