#define loop(i,a,b) for(int i=a; i<b; ++i)
#define min(a,b) (a)<(b)?a:b;
#define max(a,b) (a)>(b)?a:b;
#define sqr(a) ((a)*(a))
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
int n,h,x,y,b[100][28];
char a[101][28];

string res;

void rec( int i, int j, string s )
{
	char _s[2];
	_s[0] = j + 'A';
	_s[1]=0;
	s = _s + s;

	if ( i == x )
	{
		if ( s < res )
			res = s;
		return;
	}

	if ( b[i-1][j] == b[i][j] )
		rec( i-1, j, s );

	loop(e,0,h)
		if ( b[i-1][e] + 1 == b[i][j] )
			rec( i-1, e, s );
}

int main()
{
	freopen("input.txt","rt",stdin);
	freopen("output.txt","wt",stdout);
	scanf("%d %d\n", &n, &h);
	loop(i,0,n)
		gets( a[i] );
	scanf("%d%d", &x, &y);
	--x;
	--y;

	loop(i,0,h)
	{
		if ( a[x][i] == 'O' )
		{
			b[x][i] = 0;
		}
		else
		{
			b[x][i] = -2;
		}
	}
	int best = 0, cb;
	loop(j,x+1,y)
	{
		cb = 100500;
		loop(i,0,h)
			if ( a[j][i] == 'X' )
				b[j][i] = -2;
			else
			{
				if ( b[j-1][i] != -2 )
					b[j][i] = b[j-1][i];
				else
					b[j][i] = best + 1;

				if ( b[j][i] < cb )
					cb = b[j][i];
			}
		best = cb;
		if ( best == 100500 )
		{
			printf("Not available\n");
			return 0;
		}
	}

	res.assign(200,'Z');

	loop(i,0,h)
		if ( b[y-1][i] == best )
			rec( y-1, i, "" );

	//sort( res.begin(), res.end() );

	//loop(i,0,res.size())
	//	puts( res[i].c_str() );

	//puts( "" );
	//puts( res[0].c_str() );
	//loop(i,x,y)
	//{
	//	loop(j,0,h)
	//		if ( b[i][j] != -2 )
	//			printf("%3d ", b[i][j]);
	//		else
	//			printf("    ");
	//	puts("");
	//}

	string s = res;
	s += ' ';

	int i = 0;

	do 
	{
		printf("%c: ",s[i]);
		int l=1,f=i;
		++i;
		while ( s[i] == s[i-1] )
		{
			++i;
			++l;
		}
		printf("%d-%d\n",x+f+1,x+f+l+1);
	}
	while ( i < s.size() - 1 );
//	printf("\n");
	return 0;
}