{$apptype console}

program easy;

const
                infile='easy.in';
                outfile='easy.out';

type
                int=longint;

var a             : array[1..10001]of real;
    i,j,n,m,k,p,t : int;
    bigger        : boolean;

function More(x,y:real):boolean;
const eps = 1e-8;
begin
 More:=(x-y)>eps;
end;

function Pn(x:int):real;
var j:int;
    sum : real;
begin
 sum:=0;
 for j:=x downto x-n+1 do sum:=sum+a[j];
 Pn:=sum/n;
end;

function Pm(x:int):real;
var j:int;
    sum : real;
begin
 sum:=0;
 for j:=x downto x-m+1 do sum:=sum+a[j];
 Pm:=sum/m;
end;

procedure WriteBuy(x:integer);
begin
 writeln('BUY ON DAY ',x);
end;

procedure WriteSell(x:int);
begin
 writeln('SELL ON DAY ',x);
end;

procedure print;
var
        i:int;
begin
  assign(input,infile); reset(input);
  assign(output,outfile); rewrite(output);

  readln(m,n,k);
  for i:=1 to k do readln(a[i]);

  i:=n;
   if More(Pm(i), Pn(i)) then
    begin
     writebuy(i);
     bigger:=true;
    end
     else
   if More(Pn(i), Pm(i)) then
    begin
     writesell(i);
     bigger:=false;
    end;

   for i:=n+1 to k do
    begin
     if More(Pm(i), Pn(i)) then
      begin
       if not bigger then
        begin
         bigger:=true;
         writebuy(i);
        end;
      end
        else
       if More(Pn(i), Pm(i)) then
        begin
         if bigger then
          begin
           bigger:=false;
           writesell(i);
          end;
        end;
    end;
  close(output); close(input);
end;

begin
  print;
end.
