// b.cpp : Defines the entry point for the console application.
//

#include <stdio.h>



struct rec {
	float pm;
	float pn;
	float price;
	bool type;
};

rec *days;

float avg(int d, int o) {
	int j;
	float sum = 0;
	for (j=o-d+1; j<=o; j++) {
		sum += days[j].price;	
	}
	return sum/d;
}


int main(int argc, char* argv[])
{
	FILE *in;
	FILE *out;
	
	int m,n,k,i;
	
	in=fopen("easy.in", "r");
	out=fopen("easy.out", "w");
	
	fscanf(in, "%d", &m);
	fscanf(in, "%d", &n);
	fscanf(in, "%d", &k);

	days = new rec[k];

	for (i=1; i<=k; i++)
	{
		fscanf(in, "%f", &days[i].price);
		days[i].type = false;
	}
	
	for (i=n; i<=k; i++)
	{
		days[i].pm = avg(m, i);
		days[i].pn = avg(n, i);
		if (days[i].pm > days[i].pn) days[i].type = true;
	}

	if (days[n].pm>days[n].pn) fprintf(out, "BUY ON DAY %d\n", n);
		else fprintf(out, "SELL ON DAY %d\n", n);

	for (i=n+1; i<=k; i++)
	{
		if ((days[i-1].type == true)&&(days[i].type == false)) fprintf(out, "SELL ON DAY %d\n", i);
		if ((days[i-1].type == false)&&(days[i].type == true)) fprintf(out, "BUY ON DAY %d\n", i);
	}
	
	return 0;
}

