{$o-,q+,r+}
{ $o+,q-,r-}
{$MINSTACKSIZE $00004000}
{$APPTYPE console}
uses
    sysutils;
type
    int = longint;
const
    finname = 'easy';
var
    i, n, m, k: int;
    a, b, v: array[1 .. 10000] of extended;
begin
     reset(input, finname + '.in');
    rewrite(output, finname + '.out');

    read(m, n, k);
    for i := 1 to k do
        read(v[i]);

    a[n] := 0;
    for i := 1 to n do
        a[n] := a[n] + v[i];
    a[n] := a[n] / n;

    b[n] := 0;
    for i := n - m + 1 to n do
        b[n] := b[n] + v[i];
    b[n] := b[n] / m;

    if (a[n] > b[n]) then
        write('SELL')
    else
        write('BUY');
    writeln(' ON DAY ', n);
    for i := n + 1 to k do begin
        a[i] := a[i - 1] + (v[i] - v[i - n]) / n;
        b[i] := b[i - 1] + (v[i] - v[i - m]) / m;
        if (a[i] > b[i]) and (a[i - 1] < b[i - 1]) then
            writeln('SELL ON DAY ', i)
        else
            if (a[i] < b[i]) and (a[i - 1] > b[i - 1]) then
                writeln('BUY ON DAY ', i);
    end;

end.
