program Project1;
var
  P: Array [1..10000] of Double;
  i,j,n,m,k,amount: Integer;
  OldPn,OldPm,SPn,SPm,Pn,Pm: Double;

begin
  AssignFile(Input, 'easy.in');
  Reset(Input);
  ReadLn(m,n,k);
  for i:=1 to K do
    ReadLn(P[i]);
  CloseFile(Input);
  AssignFile(Output, 'easy.out');
  Rewrite(Output);

  SPm:=0;
  SPn:=0;
  for i:=1 to N do
    SPn:=SPn+P[i];
  for i:=n-m+1 to n do
    SPm:=Spm+P[i];
  Pn:=SPn/n;
  Pm:=Spm/m;
  if Pn > Pn then
    WriteLn('SELL ON DAY ',n)
  else
    WriteLn('BUY ON DAY ',n);
  OldPn:=Pn;
  OldPm:=Pm;
  for i:=n+1 to k do
    Begin
      SPm:=SPm+P[i]-P[i-m];
      SPn:=SPn+P[i]-P[i-n];
      Pn:=SPn/n;
      Pm:=Spm/m;
      if (OldPn > OldPm) and (Pn < Pm) then
        WriteLn('BUY ON DAY ',i);
      if (OldPn < OldPm) and (Pn > Pm) then
        WriteLn('SELL ON DAY ',i);
      OldPn:=Pn;
      OldPm:=Pm;
    end;


  CloseFile(Output);
end.
