program easy;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type rec=record
  a:real;
  bear:boolean;
  end;
var inf,outf:textfile;m,n,k,i,j:integer;
re:array[1..10000]of rec;s,sm,sn:real;
begin
  { TODO -oUser -cConsole Main : Insert code here }
  assignfile(inf,'easy.in');
  reset(inf);
  assignfile(outf,'easy.out');
  rewrite(outf);
  readln(inf,m,n,k);
  for i:=1 to k do
  begin
  readln(inf,re[i].a);
  if ((i-m+1>0)and(i-n+1>0)) then
  begin
  s:=0;
  for j:=i-m+1 to i do
  s:=s+re[j].a;
  sm:=s/(m);
  s:=0;
  for j:=i-n+1 to i do
  s:=s+re[j].a;
  sn:=s/(n);
  if sm>sn then begin re[i].bear:=false;
  if ((i=n)or(re[i-1].bear)) then writeln(outf,'BUY ON DAY ',i);end else
  begin re[i].bear:=true;
  if ((i=n)or(re[i-1].bear=false)) then writeln(outf,'SELL ON DAY ',i);end;

  end;
  end;
closefile(inf);
closefile(outf);
end.
