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();
		/*int ox1 = 0, omax = 0, omaxx = 0; 
		do {
			int max = 1, maxx = x1;
			for (int i=1;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;
			} 
			boolean b = false;
			if (ox1!=0) {
				int j=maxx-1;
				while (j>0&&free[j][max]) j--;
				j++;
				int l=1;
				while (l<omax&&!b){
					int k = ox1;
					while (free[k][l]) k++;
					if (k>=j) {
						out.println((char)((int)'A'-1+l)+": "+ox1+"-"+j);
						x1 = j;
						b = true;
					}
					l++;
				}
			}
			if (!b&&omax!=0) 
			out.println((char)((int)'A'-1+omax)+": "+ox1+"-"+omaxx);
			omax = max; ox1 = x1; omaxx = maxx;
			x1 = maxx;
		} while(x1<x2);
		out.println((char)((int)'A'-1+omax)+": "+ox1+"-"+omaxx);*/
		x2--;
		String s[] = new String[m];
		int sc = 0;
		do {
			int min = 1, minx = x2;
			for (int i=1;i<=n;i++) 
				if (free[x2][i]) {
					int j = x2-1;
					while (j>=x1&&free[j][i]) j--;
					j++;
					if (j<minx) {
						minx = j;
						min = i;
					}
				}
			if (minx==x2) {
				out.close();
				File f = new File("output.txt");
				f.createNewFile();
				out = new PrintWriter(f);
				out.println("Not available");
				out.flush();
				out.close();
				return;
			} 
			s[sc++] = String.format("%c: %d-%d",((int)'A'-1+min),minx,x2+1);
			x2 = minx-1;
		} while(x1<x2);
		for (int i=sc-1;i>=0;i--)
			out.println(s[i]);
		in.close();
		out.flush();
		out.close();
	}
}