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

public class main {
	public static void main(String[] args) throws 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 (free[j][i]&&j<x2){
						j++;
					}
					if (j>maxx) {
						maxx = j;
						max = i;
					}
				}
			out.println((char)((int)'A'-1+max)+": "+x1+"-"+maxx);
			x1 = maxx;
		} while(x1<x2);
		in.close();
		out.flush();
		out.close();
	}
}