#include <iostream.h>
#include <fstream.h>

int main(){
	fstream f("easy.in",ios::in);
	fstream fo("easy.out",ios::out);
	
	int m,n,k,c=0;
	double s=0;
	double p[10000];
	double pn[10000]={0};
	double pm[10000]={0};
	f >> m >> n >> k;
	for (int i = 1; i <=k;i++){
		f >> p[i];
	}
	//Geting PN
	for (i = n;i <= k; i++){
		s=0;
		for (int j = i-n+1; j <=i; j++){
			s=s+p[j];
		}
		pn[i]=s/n;

	}
	//Geting PM
	
	for (i = m;i <= k; i++){
	s=0;
		for (int j = i-m+1; j <=i; j++){
			s=s+p[j];
		}
		pm[i]=s/m;

	}
	double r1,r2;

	for (i=2; i<=k;i++){
		r1 = pm[i-1]-pn[i-1];
		r2 = pm[i+1]-pn[i+1];
		if (pn[i]>0 && pm[i]>0){
			if (r1<0 && r2>0 && pm[i]-pn[i] > 0){fo<< "BUY ON DAY " << i <<endl;}
			if (r1>0 && r2<0 && pm[i]-pn[i] < 0){fo<< "SELL ON DAY " << i <<endl;}

			if (pn[i-1] == 0 && r2>0){fo<< "BUY ON DAY " << i <<endl;}
			if (r1<0 && pn[i+1] == 0){fo<< "SELL ON DAY " << i <<endl;}
		}

		}
	return 0;
}