program e;

{$APPTYPE CONSOLE}

var P:array [1..10000] of extended;
    Pm, Pn, PmS, PnS, PmS_, PnS_:extended;
    i,n,m,k:integer;

begin
  { TODO -oUser -cConsole Main : Insert code here }
  assign(input,'easy.in');
  assign(output,'easy.out');
  reset(input);
  rewrite(output);

  readln(m,n,k);
  Pm:=0; Pn:=0;
  for i:=1 to m do begin
    readln(P[i]);
    Pm:=Pm+P[i];
    Pn:=Pn+P[i]
  end;

  for i:=m+1 to n do begin
    readln(P[i]);
    Pn:=Pn+P[i];
    Pm:=Pm-P[i-m]+P[i]
  end;

  PmS:=Pm/m; PnS:=Pn/n;
  if PmS>PnS then writeln('BUY ON DAY ',n)
  else writeln('SELL ON DAY ',n);

  for i:=n+1 to k do begin
    readln(P[i]);
    PmS_:=PmS; PnS_:=PnS;
    Pm:=Pm+P[i]-P[i-m];
    Pn:=Pn+P[i]-P[i-n];
    PmS:=Pm/m; PnS:=Pn/n;
    if (PmS_>PnS_) and (PmS<PnS) then writeln('SELL ON DAY ',i)
    else if (PmS_<PnS_) and (PmS>PnS) then writeln('BUY ON DAY ',i)
  end;

  close(input);
  close(output);
end.
