{$APPTYPE CONSOLE}

var n,m,k,i:longint;
    z:array[1..10000] of extended;
    last,cur:longint;
    pn,pm:array[0..10000] of extended;

begin
  assign(input,'easy.in');reset(input);
  assign(output,'easy.out');rewrite(output);
  read(m,n,k);
  for i:=1 to k do read(z[i]);

  fillchar(pn,sizeof(pn),0);
  fillchar(pm,sizeof(pm),0);

  for i:=1 to k do
  begin
    pn[i] := pn[i-1] + z[i];
    pm[i] := pm[i-1] + z[i];
    if (i-n > 0) then pn[i] := pn[i] - z[i-n];
    if (i-m > 0) then pm[i] := pm[i] - z[i-m];
  end;

  for i:=1 to k do
  begin
    pn[i] := pn[i]/n;
    pm[i] := pm[i]/m;
  end;

  last := -1;
  for i:=n to k do
  begin
    if pn[i] > pm[i] then cur := 1 else cur := 0;
    if cur <> last then
    begin
      if cur <> 0
        then writeln( 'SELL ON DAY ', i )
        else writeln('BUY ON DAY ', i );
    end;
    last := cur;
  end;

  close(input);
  close(output);

end.
