program p_e;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  fin,fout:text;
  n,m,k,h,h1:integer;
  p:array [1..100,1..3] of real;
  s:real;
  bul:array[1..100] of boolean;
  sel,t,t1:boolean;
begin
  { TODO -oUser -cConsole Main : Insert code here }
  AssignFile(fin,'easy.in');
  AssignFile(fout,'easy.out');
  Reset(fin);
  Rewrite(fout);
  Readln(fin,m,n,k);
  For h:=1 to k do
    Readln(fin,p[h,1]);
  For h:=n to k do
    begin
      s:=0;
      For h1:= h-m+1 to h do
          s:=s+p[h1,1];
      p[h,2]:=s/m;
      s:=0;
      For h1:= h-n+1 to h do
          s:= s+p[h1,1];
      p[h,3]:=s/n;
    end; { for }
  if p[n,2]>p[n,3] then writeln(fout,'BUY ON DAY ',n)
                   else writeln(fout,'SELL ON DAY ',n);

  For h:=n+1 to k do
    begin
  if (p[h,2]>p[h,3]) then if not (p[h-1,2]>p[h-1,3]) then writeln(fout,'BUY ON DAY ',h);
  if (p[h,2]<p[h,3])then if not (p[h-1,2]<p[h-1,3]) then writeln(fout,'SELL ON DAY ',h);



    end;

  CloseFile(fin);
  CloseFile(fout);
end.
