// Arup Guha
// 3/16/2017
// Solution to 2017 UCF HS Contest Problem: Diamonds in the Rough

import java.util.*;

public class diamond {

	public static int r;
	public static int c;
	public static char[][] grid;
	public static boolean[][] on;

	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 input grid
			r = stdin.nextInt();
			c = stdin.nextInt();
			grid = new char[r][];
			on = new boolean[r][c];
			for (int i=0; i<r; i++) grid[i] = stdin.next().toCharArray();

			// Try each "top" of the diamond.
			for (int i=0; i<r-1; i++) {
				for (int j=0; j<c-1; j++) {

					// Try each size.
					for (int size=1;; size++) {

						// Avoid out of bounds.
						if (impossible(i,j,size)) break;

						// Check it and mark if necessary.
						boolean valid = check(i,j,size);
						if (valid) mark(i,j,size);
					}

				}
			}

			// Case header
			System.out.println("Slab #"+loop+":");

			// Print the grid, sub in . for any off square.
			for (int i=0; i<r; i++) {
				for (int j=0; j<c; j++) {
					if (on[i][j])
						System.out.print(grid[i][j]);
					else
						System.out.print(".");
				}
				System.out.println();
			}
		}
	}

	// Checks if a diamond of size starts at (x,y).
	public static boolean check(int x, int y, int size) {

		// Top half check.
		// i = row, j = left slant, k = right slant
		for (int i=x,j=y,k=y+1; i<x+size; i++,j--,k++) {
			if (grid[i][j] != '/') return false;
			if (grid[i][k] != '\\') return false;
		}

		// Bottom half check.
		// i = row, j = left slant, k = right slant
		for (int i=x+2*size-1,j=y,k=y+1; i>=x+size; i--,j--,k++) {
			if (grid[i][j] != '\\') return false;
			if (grid[i][k] != '/') return false;
		}

		return true;
	}

	// Marks a diamond of size starting at (x,y).
	public static void mark(int x, int y, int size) {

		// Top half check.
		// i = row, j = left slant, k = right slant
		for (int i=x,j=y,k=y+1; i<x+size; i++,j--,k++) {
			on[i][j] = true;
			on[i][k] = true;
		}

		// Bottom half check.
		// i = row, j = left slant, k = right slant
		for (int i=x+2*size-1,j=y,k=y+1; i>=x+size; i--,j--,k++) {
			on[i][j] = true;
			on[i][k] = true;
		}
	}

	public static boolean impossible(int x, int y, int size) {

		// Goes too far down.
		if (x+2*size > r) return true;

		// Goes too far to the left.
		if (y-size+1 < 0) return true;

		// Goes too far to the right.
		if (y+size >= c) return true;

		// We're okay if we get here.
		return false;
	}

}