#include <stdio.h>

	int     k, m, n, i;
	float	prices[10050], Pn[10050], Pm[10050];
	int     trends[10050];

float vid(int i, int n)
{
	float sum = 0;
	for (int j = i; j < i+n; j++)
		sum += prices[j];
	return ((float) sum/n);
}


int main(void)
{
	FILE *f;

	f = fopen("easy.in", "r");
	fscanf(f, "%d %d %d", &m, &n, &k);
	for (i = 1; i <= k; i++)
		fscanf(f, "%f", &prices[i]);
	fclose(f);

	f = fopen("easy.out", "w");

	Pn[n] = vid(n-n+1, n);
	Pm[n] = vid(n-m+1, m);
	if (Pm[n] > Pn[n]) {
		trends[n] = 1;
		fprintf(f, "BUY ON DAY %d\n", n);
	}
	else { 
		trends[n] = 0;
		fprintf(f, "SELL ON DAY %d\n", n);
	}
	for (i = n+1; i <= k; i++) {
		Pn[i] = vid(i-n+1, n);
		Pm[i] = vid(i-m+1, m);
		if (Pm[i] > Pn[i]) trends[i] = 1;
			else trends[i] = 0;
		if (trends[i] == 1 && trends[i-1] == 0)
			fprintf(f, "BUY ON DAY %d\n", i);
		if (trends[i] == 0 && trends[i-1] == 1)
			fprintf(f, "SELL ON DAY %d\n", i);
	}

	fclose(f);
	return 0;
}
		


	