#include <fstream>
#include <string>

using namespace std;

const int M = 100;
const int N = 26;

int table[M][N];

int m,n;

int min(int k ) {
	int m = 1000;
	for(int i = 0; i < m; i++) 
		if( (m > table[k-1][i]) && ( table[k-1][i] != -1 ) ) m = table[k-1][i];
	return m;
}

int min_b(int k ) {
	int r = 1000,b;
	for(int i = 0; i < n; i++) 
		if( (r > table[k-1][i]) && ( table[k-1][i] != -1 ) ) {
			r = table[k-1][i];
			b = i;
		}
	return (r!=1000)? b+1 : -1;
}

int main () {
	ifstream in;
	in.open("input.txt");

	ofstream out;
	out.open("output.txt");

	in >> m >> n;

	for ( int i = 0; i < m; i++) {
		for ( int j = 0; j < n; j++) {
			char c;
			in >> c;
			table[i][j] = (c=='X')? -1 : 0;
		}
	}

	for ( int j = 0; j < n; j++) table[m][j] = -1;

	int s,f;
	in >> s >> f;

	for (int i = f-3; i>=s-1; i--) {
		for ( int j = 0; j < n; j++) {
			if( table[i][j] != -1) {
				if( table[i+1][j] != -1)
					table [i][j] = table[i+1][j];
				else table [i][j] = min(i+2)+1;
			}
		}
	}

	bool err = false, finish = false;
	
	int s1,s2=s,l = 0;
	s1 = min_b(s);
	for ( int i = s-1; i < f; i++) {		
		if(!finish && table[i][s1-1] != -1 ) l++;
		else {
			out << char(s1-1+'A') << ": " << s2 << '-' << (s2+l) << endl;
			if((s2+l)==f) finish = true;
			s1 = min_b(i+1); s2 = i+1;
			if(s1 == -1) err = true;
			l = 1;
		}
	}
	//out << char(s1+'A') << ": " << s2 << '-' << (s2+l) << endl;

	if(!finish) {
		out.close();
		out.open("output.txt");
		out << "Not available";
	}
	
	in.close();
	out.close();
}