program E;

{$APPTYPE CONSOLE}

var
  M, N, K: Integer;
  i: Integer;
  Prices: array[1..10001] of Int64;
  PM, PN: Int64;
  P: Double;
  Last: Integer;

begin
  Assign(input, 'easy.in');
  Reset(input);
  Assign(output, 'easy.out');
  ReWrite(output);
  ReadLn(M, N, K);
  for i := 1 to K do
    begin
      ReadLn(P);
      Prices[i] := Round(P * 100);
    end;
  PM := 0;
  PN := 0;
  Last := -1;
  i := 1;
  while (i <= M) do
    begin
      PM := PM + Prices[i];
      PN := PN + Prices[i];
      Inc(i);
    end;
  while (i <= N) do
    begin
      PM := PM + Prices[i] - Prices[i - M];
      PN := PN + Prices[i];
      Inc(i);
    end;
  while (i <= K + 1) do
    begin
      if (PM * n > PN * m) and ((Last = -1) or (Last = 0)) then
        WriteLn('BUY ON DAY ', i - 1);
      if (PM * n < PN * m) and ((Last = -1) or (Last = 1)) then
        WriteLn('SELL ON DAY ', i - 1);
      if (PM * n > PN * m) then
        Last := 1
      else
        Last := 0;
      PM := PM + Prices[i] - Prices[i - M];
      PN := PN + Prices[i] - Prices[i - N];
      Inc(i);
    end;
end.
