#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	FILE * in = fopen("easy.in", "rt");
	FILE * out = fopen("easy.out", "wt");

	int m,n,k,i;
	int start;

	int last_action = -1;

	float * q;
	float * Pm;
	float * Pn;

	fscanf(in, "%d", &m);
	fscanf(in, "%d", &n);
	fscanf(in, "%d", &k);

	q = (float *)malloc(k*sizeof(float));
	Pm = (float *)malloc(k*sizeof(float));
	Pn = (float *)malloc(k*sizeof(float));
	for (i = 0; i < k; i++)
	{
		fscanf(in, "%f", &q[i]);
	}

	start = 0;
	if (start < m) start = m-1;
	if (start < n) start = n-1;

	for (i = start; i < k; i++)
	{
		int j;
		float acc;

		for (j = 0, acc= 0; j < n; j++) acc += q[i-j];
		Pn[i] = acc / n;

		for (j = 0, acc= 0; j < m; j++) acc += q[i-j];
		Pm[i] = acc / m;
	}

	for (i = start; i < k; i++)
	{
		if (Pm[i] > Pn[i] && last_action != 1)
		{
			fprintf(out, "BUY ON DAY %d\n", i+1);
			last_action = 1;
		}
		else if (Pm[i] < Pn[i] && last_action != 2)
		{
			fprintf(out, "SELL ON DAY %d\n", i+1);
			last_action = 2;
		}
	}

	fcloseall();
	
	return 0;
}