program easy;

{$APPTYPE CONSOLE}

uses
  SysUtils;

label
  pls;
var
  fin,fout:text;
  i,k,n,m,g,buyday,sellday:integer;
  s:array [1..10000] of real;
  sd:boolean;
  pn,pm:real;
begin
  { TODO -oUser -cConsole Main : Insert code here }
  assign(fin,'easy.in');
  assign(fout,'easy.out');
  reset(fin);
  rewrite(fout);
  readln(fin,m,n,k);
  for i:=1 to k do
    readln(fin,s[i]);
  g:=n;
     pm:=0;
     pn:=0;
     for i:=g-m+1 to g do
       pm:=pm+s[i];
     for i:=g-n+1 to g do
       pn:=pn+s[i];
     if pn/n<pm/m then begin
                       buyday:=g;
                       sd:=true;
                       end else begin
                                sellday:=g;
                                sd:=false;
                                end;
 pls:g:=g+1;
     pm:=0;
     pn:=0;
     for i:=g-m+1 to g do
       pm:=pm+s[i];
     for i:=g-n+1 to g do
       pn:=pn+s[i];
     if (sd and (pn/n<pm/m)) or ((not sd) and(pn/n>pm/m)) then goto pls else
                                   if sd then sellday:=g else buyday:=g;

  write(fout,'BUY ON DAY ');
  writeln(fout,buyday);
  write(fout,'SELL ON DAY ');
  writeln(fout,sellday);
  close(fin);
  close(fout);
end.
