#include<stdio.h>
#include<math.h>
void main()
{
	FILE *fin,*fout;
	fin=fopen("easy.in","r");
	fout=fopen("easy.out","w");
	int mp=-1,mt=0,n,m,k,i,j;
	double sumpm=0,sumpn=0,sapm,sapn;
	double p[10005];
	fscanf(fin,"%d%d%d",&m,&n,&k);
	for(i=1;i<=k;i++)
		fscanf(fin,"%lf",&p[i]);
	p[0]=0;
	fclose(fin);
	for(i=n-m+1;i<n;i++)
		sumpm+=p[i];
	for(i=1;i<n;i++)
		sumpn+=p[i];
	for(i=n;i<=k;i++)
	{
		sumpm+=p[i];
		sumpn+=p[i];
		sapm=sumpm/m;
		sapn=sumpn/n;
//		printf("%lf %lf\n",sapm,sapn);
		if(sapm>sapn)
			mt=1;
		else
			mt=0;
		if(mt!=mp)
		{
			if(mt==0)
				fprintf(fout,"SELL ON DAY %d\n",i);
			else
				fprintf(fout,"BUY ON DAY %d\n",i);
		}
		mp=mt;
		sumpm-=p[i-m+1];
		sumpn-=p[i-n+1];
	}
	fclose(fout);
}
