{$apptype console}

uses
  SysUtils;

procedure PrintDay(N: integer; IsBuy: boolean);
var
  s: string;
begin
  if IsBuy then
    s := 'BUY ON DAY '
  else
    s := 'SELL ON DAY ';
  s := s + IntToStr(N);
  Writeln(s);
end;

var
  p: array[1..10000] of double;
  i, m, n, k: integer;
  pm, pn: double;
  bullish, newBullish: boolean;
begin
  Assign(input, 'easy.in');
  Assign(output, 'easy.out');
  Reset(input);
  Rewrite(output);
  Read(m, n, k);
  for i := 1 to k do
    Read(p[i]);
  pn := 0.0;
  pm := 0.0;
  for i := 1 to n do
    pn := pn + p[i];
  for i := n - m + 1 to n do
    pm := pm + p[i];
  bullish := pm / m > pn / n;
  PrintDay(n, bullish);
  for i := n + 1 to k do begin
    pn := pn - p[i - n] + p[i];
    pm := pm - p[i - m] + p[i];
    newBullish := pm / m > pn / n;
    if bullish xor newBullish then
      PrintDay(i, newBullish);
    bullish := newBullish;
  end;

  Close(input);
  Close(output);
end.