// Arup Guha
// 3/12/2019
// Solution to 2019 UCF HS Problem: Invertomancer

import java.util.*;

public class invert {

	final public static int UNFILLED = -1;
	final public static char BLOCK = '#';
	
	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();
		
		// Process each case.
		for (int loop=1; loop<=numCases; loop++) {
		
			// Get basic parameters.
			int h = stdin.nextInt();
			int w = stdin.nextInt();
			int jump = stdin.nextInt();
		
			// board[0] stores reg board, board[1] stores inverted board.
			int[][] board = new int[2][w];
			Arrays.fill(board[0], UNFILLED);
			Arrays.fill(board[1], UNFILLED);
		
			// Fill board.
			for (int i=h; i>=1; i--) {
				String line = stdin.next();
				for (int j=0; j<w; j++) {
					if (board[0][j] == UNFILLED && line.charAt(j) == BLOCK) {
						board[0][j] = i;
						board[1][j] = h-i;
					}
				}
			}
			
			// Run greedy - idea is that if we flip before we're forced to, we're doing no better than
			// if we waited until we were forced to.
			int res = 0, state = 0, curH = board[0][0];
			for (int i=1; i<w; i++) {
				if (board[state][i] - board[state][i-1] > jump) {
					res++;
					state = 1 - state;
				}
			}
			
			// Ta da!
			System.out.println("World #"+loop+": "+res);
		}
	}
}