import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class main {
	public static void main(String[] args) throws IOException,FileNotFoundException {
		Scanner in = new Scanner(new File("input.txt"));
		PrintWriter out = new PrintWriter(new File("output.txt"));
		int m = in.nextInt(), n = in.nextInt();
		boolean free[][] = new boolean[m+1][];
		in.nextLine();
		for (int i=1;i<=m;i++) { 
			free[i] = new boolean[n+1];
			String s = in.nextLine();
			for (int j=1;j<=n;j++) {
				if (s.charAt(j-1)=='X') free[i][j] = false; else free[i][j] = true; 
			}
		}
		int x1 = in.nextInt(), x2 = in.nextInt();
		do {
			int max = 1, maxx = x1;
			for (int i=0;i<=n;i++) 
				if (free[x1][i]) {
					int j = x1+1;
					while (j<x2&&free[j][i]){
						j++;
					}
					if (j>maxx) {
						maxx = j;
						max = i;
					}
				}
			if (maxx==x1) {
				out.close();
				File f = new File("output.txt");
				f.createNewFile();
				out = new PrintWriter(f);
				out.println("Not available");
				out.flush();
				out.close();
				return;
			} 
			out.println((char)((int)'A'-1+max)+": "+x1+"-"+maxx);
			x1 = maxx;
		} while(x1<x2);
		in.close();
		out.flush();
		out.close();
	}
}