program e;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  m,n,k,i: integer;
  p, pn,pm: array[1..100000] of double;
  sumn, summ: double;
  bearish: boolean;

begin
  bearish := false;
  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);
  sumn := 0;
  summ := 0;
  for i := 1 to n-1 do sumn := sumn + p[i];
  for i := n+1-m to n-1 do summ := summ + p[i];
  for i := n to k do
  begin
    sumn := sumn + p[i];
    summ := summ + p[i];
    pn[i] := sumn/n;
    pm[i] := summ/m;
    sumn := sumn - p[i-n+1];
    summ := summ - p[i-m+1];
    if pm[i]>pn[i] then
    begin
      if bearish or (i=n) then Writeln('BUY ON DAY ',i);
      bearish := false;
    end;
    if pm[i]<pn[i] then
    begin
      if not bearish or (i=n) then Writeln('SELL ON DAY ',i);
      bearish := true;
    end;
  end;
  CloseFile(Output);

end.
