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 h:=n to k-1 do
    begin
      bul[h]:=(((h=n)and(p[h,2]>p[h,3]))or ((p[h-1,2]<p[h-1,3])));
      if not t and (((h=n)and(p[h,2]>p[h,3]))or ((p[h-1,2]<p[h-1,3])))
         then
           begin
  //           writeln(fout,'BUY ON DAY ',h);
             t:=(((h=n)and(p[h,2]>p[h,3]))or ((p[h-1,2]<p[h-1,3])));
           end;

      if t and (((h=n)and(p[h,2]<p[h,3]))or ((p[h-1,2]>p[h-1,3])))
      then
        begin
//          writeln(fout,'SELL ON DAY ',h);
          t:= not (((h=n)and(p[h,2]<p[h,3]))or ((p[h-1,2]>p[h-1,3])));
        end;

    end;
  //writeln(fout);
  For h:=n+1 to k-1 do
    begin
      if bul[h]<>bul[h-1] then
        if bul[h] then writeln(fout,'SELL ON DAY ',h-1)
                  else writeln(fout,'BUY ON DAY ',h-1);
    end;

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