#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <string.h>

#define NONE 0
#define BULL 1
#define BEAR 2

using namespace std;

FILE* in=fopen("easy.in","r");
//FILE* in=stdin;
FILE* out=fopen("easy.out","w");
//FILE* out=stdout;

const long N = 10005;

double p[N],mval[N],nval[N];


int main()
{
	long n,m,k,i;
	fscanf(in,"%ld%ld%ld",&m,&n,&k);
	for(i=0;i<k;++i)
		fscanf(in,"%lf",&p[i]);
	fill(mval,mval+k,0);
	fill(nval,nval+k,0);
	mval[0]=p[0];
	nval[0]=p[0];

	for(i=1;i<m;++i)
		mval[i]=mval[i-1]+p[i];
	for(i=1;i<n;++i)
		nval[i]=nval[i-1]+p[i];
	
	for(i=m;i<k;++i)
		mval[i]=mval[i-1]+p[i]-p[i-m];

	for(i=n;i<k;++i)
		nval[i]=nval[i-1]+p[i]-p[i-n];

	long fl=NONE;
	double Pim,Pin;
	for(i=n-1;i<k;++i)
	{
		Pim=mval[i]/m;
		Pin=nval[i]/n;
		if (Pim>Pin)
		{
			if (i==n-1 || fl==BEAR)
			{
				fl=BULL;
				fprintf(out,"BUY ON DAY %ld\n",i+1);
				continue;
			}
		}
		if (Pim<Pin)
		{
			if (i==n-1 || fl==BULL)
			{
				fl=BEAR;
				fprintf(out,"SELL ON DAY %ld\n",i+1);
				continue;
			}
		}
	}
	return 0;
}