PROGRAM ASD;
Const InFile='easy.in';
        OutFile='easy.out';
var a                   : array[1..10001] of extended;
    i,j,k,l,n,m         : longint;
    s,s1                 : extended;
    p,p1                : array[1..10001] of extended;
    {----------------------------------------------}
PROCEDURE VVOD;
BEGIN
 Assign(input,infile);
 Reset(input);
  read(M,N,k);
  for i:=1 to k do
   read(a[i]);
 Close(input);
END;
{----------------------------------------------}
PROCEDURE OCNOV;
BEGIN
 s:=0;
 for i:=1 to m do
  s:=s+a[i];
 for i:=m+1 to n do
  begin
   s:=s+a[i]-a[i-m];
  end;
 s1:=0;
 for i:=1 to n do
  s1:=s1+a[i];
 p[n]:=s/m;
 p1[n]:=s1/n;
 for i:=n+1 to k do
  begin
   s:=s+a[i]-a[i-m];
   s1:=s1+a[i]-a[i-n];
   p[i]:=s/m;
   p1[i]:=s1/n;
  end;
END;
{----------------------------------------------}
PROCEDURE VIVOD;
BEGIN
 Assign(output,outfile);
 Rewrite(output);
  for i:=n to k do
   BEGIN
    if (p[i]>p1[i])and((i=n)or(p[i-1]<p1[i-1])) then
     writeln('BUY ON DAY ',I);
    if (p[i]<p1[i])and((i=n)or(p[i-1]>p1[i-1])) then
     writeln('SELL ON DAY ',I);
   END;
 Close(output);
END;
{----------------------------------------------}
BEGIN
 vvod;
 ocnov;
 vivod;
END.
