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

struct stock
{
	int day;
	double pm, pn;
};

int main()
{
	
	
	
	//stock *Pm, *Pn;
	stock *elems;
	double *Prices;
	double tmpM = 0 , tmpN = 0;
	bool change = true, tmp; 
	
	int m,n,k;
	int i;
	
	ifstream InFile  ("easy.in", ios::in);
	ofstream OutFile ("easy.out", ios::out);
	
	
	
	InFile >> m >> n >> k;
	
	Prices = new double[k];
	
	elems = new stock[k - n + 1];
	
	
	for (i = 0; i < n; i++)
	{
		InFile >> Prices[i];
		tmpN = tmpN + Prices[i];
		
		if (i >= n - m ) tmpM = tmpM + Prices[i];
	}
	
	for ( i = n ; i < k; i++)
	{
		InFile >> Prices[i];
		
		elems[i - n].day = i ;
		elems[i - n].pn = tmpN / n;
		elems[i - n].pm = tmpM / m;
		
		tmpN = tmpN + Prices[i];
		tmpM = tmpM + Prices[i];
		
		
		tmpN = tmpN - Prices[i - n];
		tmpM = tmpM - Prices[i - n + m - 1];
		
	}
	
	
	for (i = 0; i < k - n +  1; i++)
	{
		if ( n == elems[i].day )
		{
			if ( elems[i].pm > elems[i].pn) 
				OutFile << "BUY ON DAY " << elems[i].day << endl;
			else 
				OutFile << "SELL ON DAY " << elems[i].day << endl;
		}
		else 
		{
			
			if  ( (elems[i].pm > elems[i].pn ) && (elems[i-1].pm < elems[i-1].pn )) 
			{
				OutFile << "BUY ON DAY " << elems[i].day  << endl;
				
			}
			
			else if ( (elems[i].pm < elems[i].pn ) && (elems[i-1].pm > elems[i-1].pn ))
			{	
				OutFile << "SELL ON DAY " << elems[i].day << endl;
			}
			
		}
		
			
	}
	return 0;
}