#include <stdio.h>
#include <string.h>

#define MAX(a,b) ((a>b)? (a) : (b))

long strtoint(char *str) {
	int lstr=strlen(str);
	int		i, pt=-1;
	long	res;
	for (i=0; i<lstr; i++)
		if (str[i]=='.') {
			pt=i;
			break;
		}
	if (pt!=-1) {
		for (i=pt; i<lstr-1; i++) str[i]=str[i+1];
		str[lstr-1]=0;
	}
	sscanf(str,"%ld",&res);
	return res;
}

int main() {
	FILE	*FI, *FO;
	FI=fopen("easy.in","rt");
	FO=fopen("easy.out","wt");
	int		m, n, k, i;
	long	num[12000];
	char	str[10];
	fscanf(FI,"%d %d %d",&m,&n,&k);
	for (i=0; i<k; i++) {
		fscanf(FI,"%s",str);
		num[i]=strtoint(str);
	}

	long	summ=0, sumn=0;
	for (i=0; i<n; i++) sumn+=num[i];
	for (i=n-m; i<n; i++) summ+=num[i];
	char	cond=-1;
	char	cond2;
	for (i=n-1; i<k; i++) {
		cond2=(summ*n>sumn*m)?0:1;
		if (cond2==0 && (i==n-1 || cond==1)) fprintf(FO,"BUY ON DAY %d\n",i+1);
		if (cond2==1 && (i==n-1 || cond==0)) fprintf(FO,"SELL ON DAY %d\n",i+1);
		if (i<k-1) {
			summ+=num[i+1];
			sumn+=num[i+1];
			summ-=num[i-m+1];
			sumn-=num[i-n+1];
		}
		cond=cond2;
	}


	fclose(FI);
	fclose(FO);
	return 0;
}