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();
		x2--;
		String s[] = new String[m];
		int sc = 0;
		do {
			int min = 1, minx = x2+1;
			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+1) {
				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();
	}
}