// Arup Guha
// 1/30/2015
// Solution to 2014 MCPC Problem B: Fun House

// Note: This is a very bulky solution...I wrote it really quickly. If I spent some time, I could make it
//       quite a bit more compact.

import java.util.*;

public class b {

	public static int r;
	public static int c;
	public static char[][] grid;

	public static void main(String[] args) {

		int loop = 1;
		Scanner stdin = new Scanner(System.in);
		c = stdin.nextInt();
		r = stdin.nextInt();

		while (r != 0) {

			// Read in grid.
			grid = new char[r][];
			for (int i=0; i<r; i++)
				grid[i] = stdin.next().toCharArray();

			// Get starting spot.
			int[] start = findStart();

			// Find ending spot and change.
			int[] end = sim(start);
			grid[end[0]][end[1]] = '&';

			// Print result.
			System.out.println("HOUSE "+loop);
			for (int i=0; i<r; i++)
				System.out.println(new String(grid[i]));

			// Get next case.
			c = stdin.nextInt();
			r = stdin.nextInt();
			loop++;
		}
	}

	public static int[] sim(int[] start) {

		// Set up current position and delta.
		int dx = 0, dy = 0;
		if (start[0] == 0) dx = 1;
		if (start[0] == r-1) dx = -1;
		if (start[1] == 0) dy = 1;
		if (start[1] == c-1) dy = -1;
		int x = start[0];
		int y = start[1];

		while (grid[x][y] != 'x') {

			// Move point.
			x += dx;
			y += dy;

			// See if it's a "forward" mirror.
			if (grid[x][y] == '/') {

				// See whether we're moving in x or y and change accordingly.
				if (dx != 0) {
					dy = -dx;
					dx = 0;
				}
				else {
					dx = -dy;
					dy = 0;
				}
			}

			// Different formula for change for backwards mirror.
			else if (grid[x][y] == '\\') {

				// See whether we're moving in x or y and change accordingly.
				if (dx != 0) {
					dy = dx;
					dx = 0;
				}
				else {
					dx = dy;
					dy = 0;
				}
			}
		}

		// Return the result.
		int[] res = new int[2];
		res[0] = x;
		res[1] = y;
		return res;
	}

	// Finds * and returns its location.
	public static int[] findStart() {

		int[] res = new int[2];
		for (int i=0; i<r; i++) {
			for (int j=0; j<c; j++) {
				if (grid[i][j] == '*') {
					res[0] = i;
					res[1] = j;
				}
			}
		}
		return res;
	}
}